WordPress.org

Forums

WordPress Related Posts
[resolved] Related content on homepage (6 posts)

  1. fiddleandspoon
    Member
    Posted 9 months ago #

    Excellent plugin, thank you!

    Just wondering, is it possible to display "related posts" under the posts on the index page?

    Blog is here: http://www.fiddleandspoon.com

    Thank you so much!

    https://wordpress.org/plugins/wordpress-23-related-posts-plugin/

  2. PetraP
    Member
    Plugin Author

    Posted 9 months ago #

    Hey,

    thanks for reaching out!
    Sure, you can have those show on your homepage by going to your WordPress's Dashboard and under the tab 'Appearance'-'Editor' choose your theme (I think yours is "ladylucktheme") in the upper right corner. Now click on the 'content.php' file, which you can find on the right hand side of your screen. After that, search for the following code in the code editor:

    [ Moderator note: Code fixed, please wrap code in backticks or use the code button. ]

    <div class="entry-content">
    <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'ladylucktheme' ) ); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'ladylucktheme' ) . '</span>', 'after' => '</div>' ) ); ?>
    </div><!-- .entry-content -->
    <?php endif; ?>
    Now that you have found this, just add the following code line at the end of it:

    <?php wp_related_posts()?>

    So, to sum it up, the whole thing should look like this:

    <div class="entry-content">
    <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'ladylucktheme' ) ); ?>
    <?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'ladylucktheme' ) . '</span>', 'after' => '</div>' ) ); ?>
    </div><!-- .entry-content -->
    <?php endif; ?>
    <?php wp_related_posts()?>
    `
    Remember to click on the 'Update File' button when you're finished. Visit your blog, refresh the whole page and you should be able to see those related posts over there.

    Did it work?
    Need any further assistance or do you have any other questions? Let me know — I'll gladly help!

    Take care and have a nice day,
    Petra

  3. fiddleandspoon
    Member
    Posted 9 months ago #

    Thank you so much Petra, worked perfectly!

    Have a lovely day x

  4. PetraP
    Member
    Plugin Author

    Posted 9 months ago #

    Happy to hear it worked :D

    All the best,
    Petra

  5. cjb4g08
    Member
    Posted 9 months ago #

    Hi Petra,

    I've just tried to follow your instructions but my theme doesn;t seem to have a content.php file - any ideas what I should do?

    site is bristolbeatsclub.com

    Cheers!

    Chris

  6. PetraP
    Member
    Plugin Author

    Posted 9 months ago #

    Hey Chris,

    thanks for reaching out! If I am not mistaken you are using the "Fixed" theme? Unfortunately this theme is not free to use, so I can't install it on my side. Can you make a screenshot of the files you do have?

    Looking forward to your reply,
    Petra

Reply

You must log in to post.

About this Plugin

About this Topic