Blog How to Adjust the Placement of Related Posts for WP Plugin
By default, the Related Posts for WP plugin displays the lists of posts after the primary content area, which is printed using a WordPress function called the_content(); on each page. If there’s additional content which is displayed below the main content area, the related posts will appear above the extra items. However, it’s a quick change to adjust the placement of where the related posts show up.
A support thread on the official WordPress forum for this plugin provided two code snippets, one by the plugin author Harish Chouhan and the other by user florianwilhelm who created the thread and was trying to move the related posts to the bottom of his pages.
The first piece of code is used to disable the default placement and can be placed in the functions.php file inside the active WordPress theme.
// Disable the default Related Posts for WP placement
add_filter( 'rp4wp_append_content', '__return_false' );
The second snippet is a function to display the related posts list wherever you’d like. This can be placed using PHP in your page template files.
// Add the Related Posts for WP list display
When using the Advanced Custom Fields plugin or other plugins to add more content below the primary text block, these two pieces of code can be very useful. The filter and function can ensure the related posts always display at the bottom of the page – or anywhere else you prefer.