WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How do you make your post title precede your blog's title in search results? (8 posts)

  1. KevinKane
    Member
    Posted 3 years ago #

    If you search for "Copyblogger writing," the first result is "How to Write Magnetic Headlines | Copyblogger."

    The post title "How to Write Magnetic Headlines" is listed before the blog title, "Copyblogger."

    How can I do that for my blog?

    If you search for "7 predictions for future of computers," the first result is "Kevin's Notes ยป 7 Predictions for the Future of Computers."

    I want to rearrange the order so it shows: "7 Predictions for the Future of Computers | Kevin's Notes"

    Does anyone know how to do this? Thank you.

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    Try using something like:

    <title><?php global $page, $paged;
    wp_title( '|', true, 'right' );
    bloginfo( 'name' );
    $site_description = get_bloginfo( 'description', 'display' );
    if ( $site_description && ( is_home() || is_front_page() ) ) echo " | $site_description";
    ?></title>

    in header.php

  3. KevinKane
    Member
    Posted 3 years ago #

    Esmi, thanks.

    If I use your code above, should I delete the code below (which is in my header.php right now):

    <!-- code to control titles in search engine results START -->
    <?php if (is_single() || is_page() || is_archive()) { wp_title('',true); } else { bloginfo('description'); } ?> — <?php bloginfo('name'); ?>
    <!-- code to control titles in search engine results END-->
  4. esmi
    Forum Moderator
    Posted 3 years ago #

    Yes but please keep a backup copy of header.php in case there's a syntax error in the code that I posted.

  5. KevinKane
    Member
    Posted 3 years ago #

    esmi, I swapped my old code with the new code you provided.

    I then did a Google search and I see that my blog title still precedes my post title.

    Does this mean that the new code doesn't work? Or does it take some time for Google to index with the new code? Thanks.

  6. esmi
    Forum Moderator
    Posted 3 years ago #

    It could take anything up to 90 days for Google to re-index all of your posts.

  7. KevinKane
    Member
    Posted 3 years ago #

    Esmi, I'll write a follow-up post later to let you know if this code changes the way Google displays my posts. Thanks.

  8. KevinKane
    Member
    Posted 3 years ago #

    I found the solution!

    Install the WordPress plugin "All in One SEO Pack."

    The plugin's default format for post titles is:

    "%post_title% | %blog_title%"

    You don't have to change any of the plugin's settings or edit any code.

    You will see the SERP changes in a day or so.

Topic Closed

This topic has been closed to new replies.

About this Topic