Where do I have to add this to the child theme?

Hi, I am kind of lost here…I am using this plugin https://de.wordpress.org/plugins/related-posts-for-wp/ . The related post do show on post I made with the standard WP Editor. When I use Pro, they do show in the pro editor window, but not when I open the page in the browser. I checked all other plugins for interference, but there ist nothing interfering. So I figured I add the function to call for the related posts to my theme.

<?php // Display related posts of current post rp4wp_children(); // Display related posts of specific post rp4wp_children( 2 ); // Return output instead of displaying it $output = rp4wp_children( 2, false ); But I have no clue how and where I have to add it to the childtheme so the related posts are displaed after the post. Can you help me? The related posts do show if I add the shortcode [rp4wp] to the post....but I don´t want to manually add this to all my 250+ posts. So maybe the child theme would be an option....

Hi @kathringuttmann,

You can do it using actions, try adding the code below in your child theme’s functions.php file

function add_related_posts() {
if(is_singular('post')) {
    rp4wp_children();
}
}

add_action( 'x_before_the_content_end', 'add_related_posts' );

For more information kindly refer to the link below

Hope that helps

It works…THANK YOU SO MUCH! Themeco has the best support ever! That´s why I already bought my 3rd license :slight_smile:

You’re most welcome @kathringuttmann ! :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.