Tweaking WordPress: Home page tweaks

Here is another guest post by Brian explaining how to tweak the home page display.

Many people new to blogging and WordPress, and some intermediates, are a little confused about what actually is their home page.

Let us start by defining the home page in the greater scheme of things. The home page is the first page a browser opens when directed at a website or when the website’s "home" button is pressed.

For a newly installed WordPress installation that hasn’t been tweaked the home page is a page showing your last 10 posts (posts..... not pages), so when you click the ‘Home’ tab on the Grace themes in the top left, this is where you end up.

As can be expected of WordPress, this can be altered, and very simply as well. You’ll need to open up your admin panel and under ‘Settings’ go to ‘Reading’.

  1. You are given the choice to have your home page open as a typical blog, showing posts, or onto a single page, like a traditional website.

  2. If you have chosen a page, you must now tell WordPress which one you wish to display. Note – the drop down list will only show published pages.

  3. Finally, WordPress needs to know how to access your posts. So again you are presented with a choice of pages to display your blog on.

One problem people find...and can’t deal with.... after they select a page to be their home page is that the tab for that page appears at the top left of the blog on the page menu even though the tab ’Home’ is there. Like a dual link! For this fix head over into the theme editor and open the header.php

The following code controls the ‘page menu’ bar at the top of the blog. With some tweaking this bar can display anything you want.


Some basic changes were mentioned in this previous tutorial. However the example I gave was a very basic HTML example. For a more in-depth look at what can be done with the page menu look at the WordPress page on Page Template Tags.

Here is the basic way to avoid the extra home page tab.

Find the page id number (either hover over it in the ‘admin panel/edit pages’ list and look at the URL, or install the plugin Restore ID), then in header.php turn this –

<?php wp_list_pages('sort_column=menu_order&title_li='); ?>

Into this –

<?php wp_list_pages('sort_column=menu_order&exclude=2&title_li='); ?>

…using the correct page ID.

Some people don’t like the word ‘Home’ to be displayed in that tab. Well change it then! In the code above change the word ‘Home’ .


More like this:


Posted in: WordPress
TAGS:, , , , , , , , , , , , , , ,
Both comments and trackbacks are currently closed.

12 Comments

  1. Ruzanna
    Feb 7th, 2010 10:34 AM

    Hi,

    I have an onsite blog at http://www.criminaldefenseduilawyer.com/blog/ . This is a wordpress site where a static page is displayed on the homepage and the posts are going to a static page called 'blog'. The configurations are done within wordpress's configuration guidelines shown in this article.

    The problem I am experiencing is that the 'blog' page is a static page and its last update date is an old date, the one when the page was last edited. However, I have posts coming to that page almost every day. So in reality it is being updated much more frequently. Please see the sitemap where for the last modified date: http://www.criminaldefenseduilawyer.com/sitemap.xml

    I suspect that this confuses search engines and and they also see the blog page http://www.criminaldefenseduilawyer.com/blog/ last updated much earlier than the real date. This results in the fact that the category and tag pages are more popular than the blog page, while these are getting rarely updated compared with the http://www.criminaldefenseduilawyer.com/blog/ page.

    My question is how can I use wordpress's functionality of displaying posts on a static page instead of the homepage and having a correct last modified date for that static page, so that the search engines also know that this page is being updated almost every day.

    • Wordpress Brian
      Feb 9th, 2010 6:06 PM

      Hi Ruzzana,

      Are you using a plugin for the sitemap? I use the Google XML Sitemap Generator plugin and have no problems with posts being displayed on Google searches 10 mins after being posted, despite the age of the 'blog page'.

      I understand your point about the initial creation date of the page but I have never in all my studying of wordpress SEO heard of it being an issue.

      • Ruzanna
        Feb 11th, 2010 2:21 PM

        thanks for the answer Brian, i am also using google xml sitemap creator and i have always been indexed in a few minuter after posting. ironically, after making changes to wordpress theme, everything went wrong. and the date of my 'blog' page was last updated is that very exact date when my site's appearance in serps went down.

  2. Feb 6th, 2010 1:09 AM

    I have a question along these lines, that I can't find an answer to...

    I am using the a static page for my home page, but I would like to set a div above the start of that page's content with the title and possibly the excerpt to the most recent post (just one). I don't know the codex well enough to figure out how to make that info show up.

    Is this an easy piece of code to implement?

    • Wordpress Brian
      Feb 8th, 2010 5:52 PM

      Hi Tom,

      Look up WordPress Conditional Tags - is_front_page()

      Then find the Template Tag for recent post.

      And glue it together!

      Then put between 'divs' in the appropriate place in the index file.

      • Feb 8th, 2010 9:41 PM

        Ok - thanks - I got the is_front_page() working... but when I use the tag for wp_get_recent_posts( '1' ) and then displaying the title - it is showing the title of the current page - not the most recent post. I will try to dig around more when I have another chance (after work, or tomorrow at lunch) but any other ideas on why I am pulling the static page title may help.

        And - thanks for 'pointing me' - it helps to learn the codex more than just copy paste (albeit, not as easy)

  3. Feb 5th, 2010 5:54 PM

    Always good information, Vladimir! I do some of the WordPress stuff myself but usually outsource to code gurus like you, but I have a quick question I'd love to solve and it is inline with this article which also solves one of my problems on another site, so thank you and in advance for answering the question - I'll try to make it a yes or no for you...

    In this same line
    <a href="/" >Home

    Am I able to remove the link and replace it with my own to redirect the home page?
    /

    What I would love to see work is:
    Home

    My blog is seperate from the site, so I would love the Blog's Home button to actually go to the site home... is this how I would do it? I think I overworded the question - my apologies.

    Thanks for all the good information!

    • Feb 5th, 2010 5:55 PM

      Ya whoops... ill paste in an email good thing I copied before posting. Feel free to delete both comments...

      • Feb 6th, 2010 1:20 AM

        As I said in the email, yes it is possible to redirect 'home' to whatever you need to be there.

        • mike
          Jul 13th, 2010 9:18 PM

          how is it possible to change my home button in wordpress to point to a different link?

          i would love for you to answer this!

          thanks!

  4. Feb 5th, 2010 5:13 PM

    Please: get_settings is deprecated in version 2.1 and i think, a new tutorial use the right functions: get_option or in your example: get_bloginfo or bloginfo without echo.

    Sorry for my bad english.
    Best regards

    • Feb 6th, 2010 1:19 AM

      Nice catch, updated the post. Thanks.