Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1081827

    i want to change the related post style to grid. please help me.

    #1083382

    Hey Vadivel,

    Thank you for using Enfold.

    Edit the single.php file and look for this code around line 46:

    //show related posts based on tags if there are any
    	                        get_template_part( 'includes/related-posts');
    

    Get the tags of the posts and set them as the value of an attribute of the blog posts shortcode:

    	global $post;
    							$tags = wp_get_post_tags($post->ID);
    							foreach ($tags as $tag) {
    								$post_tags[] = $tag->term_id;
    							}
    
    	                        echo do_shortcode("[av_blog blog_type='taxonomy' link='post_tag,".implode(',', $post_tags)."' blog_style='blog-grid' columns='3' contents='excerpt' content_length='content' preview_mode='auto' image_size='portfolio' items='3' offset='0' paginate='yes']");
    

    Best regards,
    Ismael

    #1083529

    Hi Ismael,

    Thanks for the solution, i have applied the shortcode but, same post is also listing in the grid post. please help me.

    #1084541

    Hi,

    Thanks for the update.

    Use this filter in the functions.php file to exclude the current post.

    add_filter('avia_post_slide_query','avia_post_slide_query_mod', 10, 2);
    function avia_post_slide_query_mod($query, $params)
    {
        if(is_singular('post')) {
            $query['post__not_in'] = array(avia_get_the_ID());
        }
        return $query;
    }
    

    Best regards,
    Ismael

    #1084581

    Thanks Its working fine.

    #1084603

    Please Help me how i can add heding top of related post like related content.

    #1085202

    Hi,

    Just place the heading markup above the previous code that was just added.

    global $post;
    

    Something like this should work.

    echo "<h3>Related posts<h3>";
    

    Best regards,
    Ismael

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.