WordPress.org

Ready to get started?Download WordPress

Forums

Custom Home Page Title (2 posts)

  1. chiappa
    Member
    Posted 1 year ago #

    How do I change a unique custom homepage title which is not dependent on Site title or Tagline?

    header.php is:

    <title><?php bloginfo('name'); ?> <?php wp_title(); ?></title>

    I saw a bunch of plugins where you can change the title of posts and pages. My home page does not have one. Front page displays is set to Your latest posts.

    I found one how to where they said to add this to the <title> code:

    <title><? if ($_SERVER["REQUEST_URI"] == "/"){
    echo "Put Unique Home Page Title Here";
    }else{
    ?>

    this just prints all that <? if ($... stuff in the title.

    Please help! Thank you :)

  2. jinsha
    Member
    Posted 1 year ago #

    Hmm, not the exact solution but if you can play around with the tagline you could do something like this:

    <?php
    $blog_title = get_bloginfo('name');
    if (is_home()) {
        $blog_title = . get_bloginfo('description');
    }
    if (is_page()) {
        $blog_title = . get_the_title(); . " | " . get_bloginfo('name')
    }
    ?>
    <title><?php echo $blog_title; ?></title>

    This would print just the tagline as the home page title and give site name/page name for pages.

    or

    if (is_home()) {
        $blog_title = get_bloginfo('name') . " | " . get_bloginfo('description');
    }

    to ad site name to the page title. You can see an example here. Hope this helps.

Topic Closed

This topic has been closed to new replies.

About this Topic