Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Static home page doesn’t load page title

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #31346
    Danilux
    Member

    Hi, I’m using wordpress to build a portfolio page, I have created 4 pages:
    Home, Portfolio, Contact, About. In the title tag I’m using the following code to show the title of the current page plus the name of the website:

    Everything works fine each one shows the title along with the name for all four pages:

    http://localhost/home/ = Home • Site Name
    http://localhost/portfolio/ = Portfolio • Site Name
    http://localhost/contact/ = Contact • Site Name
    http://localhost/about/ = About • Site Name

    But when I go to the main url http://localhost/ it displays the home page but in the browser’s tab it only displays the name of the site and not the title of the actual page which should be ‘home’.

    I’m using wamp locally and a custome template for each page because each has unique content so it goes like: myhome.php portfolio.php contact.php and about.php.

    In the dashboard I have set in reading setting the Home custome template page as static page, also I have not created the page.php I don’t know If that has to do with this problem. Any help would be appreciated, thanks.

    #64498
    clokey2k
    Participant

    I don’t think ‘wp_title()’ outputs a homepage title. Maybe create a seperate title option using ‘is_home()’:

    
    echo "Homepage |"; bloginfo('name');
    } else {
    wp_title('$bullet;','true','right'); bloginfo('name');
    }
    ?>

    Something like this could work – not tested it though!

    #64500
    Danilux
    Member

    Hi, clokey2k, I think that is correct, I have tried a lot of solutions and wp_title doesn’t output the home title ever. I was actually tring to keep it dinamic but If the only way is to hardcode it I guess I’ll go with that. Your code didn’t work but I modified it a little with the is_front_page() and now the homepage title displays right “Home • Site Name”

    Here’s the code if it’s usefull for someone else:




    echo "Home •"; bloginfo('name'); ?>





    PS: If removed the is_home() conditional tag works too.

    Another question tought, How would I go about if in the future I’d like to add a blog and would like to display the title of the post plus the site name kinda like the same structure but with the post name before. Example: “This is the post title • Site name”

    How would I add that to this title structure?

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.