Child theme code to call query_post after wp_home/wp_title (5 posts)

  1. newbie2012
    Posted 4 years ago #


    I would really appreciate some help.

    I am using WordPress SEO by Yoast with the suffusion wordpress theme and I've noticed that when I add a query post on my website, the title displayed on my browser is always the title of the last post in the query post widget.

    I've found on the web that the way to solve this is to make sure that the call to wp_head or wp_title (not sure which one) has to come before the call to query_posts.

    I'm not familiar with coding and was wondering how I could achieve this with a child theme?

    As well, could these changes cause any potential problems.

    Thanks in advance for the help.

    I did not add <title><?php wp_title(''); ?></title> to my header.php but just checked the box to Force rewrite titles in the WordPress SEO plugin

  2. Michael
    Forum Moderator
    Posted 4 years ago #

    are you ending you query_posts loop with wp_reset_query(); ?


  3. newbie2012
    Posted 4 years ago #

    Appreciate the reply.

    Just to clarify, the query posts are actually built-in widgets of the theme that I have added to my sidebars. I have not added any code.

    I don't understand coding and have tried using your suggestion and some online tutorials to add this code in the suffusion child theme:

    add_action("after_setup_theme", "suffu_scion_theme_setup", 15);

    function suffu_scion_theme_setup() {

    This doesn't work though. Would you have any other suggestions.


    P.S. I have also changed the 15 to 1 but still nothing happens.

  4. Sayontan Sinha
    Posted 4 years ago #

    In the suffusion-query-posts.php file, around line 182 you will see this:

    $ret .= "</ul>";

    Just before this line add:


  5. newbie2012
    Posted 4 years ago #

    Works like a charm!

    By far the best and most versatile theme.

    Thank you very much Sayontan.

Topic Closed

This topic has been closed to new replies.

About this Topic