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.
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.
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.