Move Related Posts Below Comments
|
/ Documentation /Custom Code Snippets/Astra Theme & Pro Filters/ Move Related Posts Below Comments

Move Related Posts Below Comments

With the Astra theme, you can display related posts on all your posts. This document will provide a custom code to move related posts below the comments section.

What Is The Result?

The related posts section is displayed below your post content by default. Also, it’s a great feature that helps your users find additional interesting content from the same category. But, at the same time, this means that your users might overlook the comments section before moving to a related post.

Related Posts

Thus, you might want to move this section below the comments section, allowing your user to first go through comments. Further, you can do this easily by adding a custom code to your website.

Related Posts Below Comments

How To Do This?

To disable Astra Global colours in Elementor, you need to add an action. You can add the following custom code to the functions.php file of your Child Theme:

# Move Related Posts Below Comments

add_action( 'astra_entry_before', function() {
	add_filter( 'astra_get_option_enable-related-posts', '__return_false' );
} );
add_action( 'astra_primary_content_bottom', function() {
	add_filter( 'astra_get_option_enable-related-posts', '__return_true' );
} );
add_action( 'astra_template_parts_content_top', 'action_to_update_related_post_markup', 1 );
function action_to_update_related_post_markup() {
	$related_post_markup_instance = new Astra_Related_Posts_Markup();
	add_action( 'comment_form_after', array( $related_post_markup_instance, 'astra_get_related_posts' ), 10 );
}

If you don’t have your Child Theme installed, please check this article on how to do it. 
If you are not sure how to add this code, please check this article.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

This field is required.

REWIND

YEAR IN REVIEW

Scroll to Top
Now choose your preferred
page builder addon
Choose your preferred page builder addon

Download is Just A Click Away!

Enter your email address and be the first to learn about updates and new features.

Download Free Astra Theme - Modal Popup Form