Tagged: related posts
Hi,
Is it possible to replace the ‘related posts’ section on the blog’s Single Posts with one created/designed using the Advanced Layout Editor?
Got the related posts file already working in the child theme, just need to know if possible to create the section differently and then how to add it in there.
Thx
Hey Bozzy78,
Thank you for using Enfold.
How did you modify the file? Try to edit the single.php file. Look for the following code.
//show related posts based on tags if there are any
get_template_part( 'includes/related-posts');
And then replace it with:
$post = get_post( 23 ); // id of the custom related posts page
if( ( $post instanceof WP_Post ) && ( $post->ID != get_the_ID() ) )
{
/**
* Make sure that footerpage is set to fullwidth
*/
$old_avia_config = $avia_config;
$avia_config['layout']['current'] = array(
'content' => 'av-content-full alpha',
'sidebar' => 'hidden',
'meta' => '',
'entry' => '',
'main' => 'fullsize'
);
$builder_stat = ( 'active' == Avia_Builder()->get_alb_builder_status( $post->ID ) );
$avia_config['conditionals']['is_builder'] = $builder_stat;
$avia_config['conditionals']['is_builder_template'] = $builder_stat;
$content = Avia_Builder()->compile_post_content( $post );
$avia_config = $old_avia_config;
/* was removed in 4.2.7 before rollout - should not break the output - can be removed completly when no errors are reported !
*
<div class='container_wrap footer_color footer-page-content' id='footer'>
*/
echo $content;
}
Replace the value of the get_post function inside the $post with the ID of your custom related posts page.
Best regards,
Ismael