Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1049588

    I have found a few similar threads in the forum trying to solve this issue, from which I have tried the following codes to no avail:

    add_filter('avia_blog_post_query', 'enfold_customization_query_custom');
    function enfold_customization_query_custom( $query ) {
    global $wp_query;
    if ( is_single() ) {
    $query['post__not_in'] = array($post->ID);
    return $query;
    }}
    
    /* also not working */
    
    add_filter('avia_post_grid_query', 'avf_custom_post_grid_query');
    function avf_custom_post_grid_query ( $query ) {
      if(is_singular()) {
      	global $post;
      	$query['post__not_in'] = array($post->id);
      }
      return $query;
    }

    I am not sure if the problem is due to the post type being a custom post type called ‘knowledge_articles’ instead of posts? If anyone could shed some light on why the above code is not working, it would be much appreciated.

    A link to one of the blog posts is in the private content, but please note the posts display randomly, so you may need to refresh a few times before seeing the current post within the blog post grid.

    Thanks for your help.

    #1049837

    Hey Birdster,

    Thank you for using Enfold.

    I don’t see the current post in the blog posts element at the very bottom of the post page. Is this fixed?

    Best regards,
    Ismael

    #1049971

    Hi Ismael,

    I haven’t solved this yet, but the blog post element shows randomly selected posts – therefore you will need to press f5 a few times until the issue occurs.

    Thanks,

    #1050009

    Now fixed, the code i had copied from an earlier thread didn’t correctly reference the slide query hook. Maybe it was from an older version of enfold, but I have changed it to:

    avia_post_slide_query

    and it seems to work as expected.

    Thanks and please close this question.

    #1050241

    Hi,

    Great, glad you got it working and thanks for the update. I’ll close this for now then, please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Hide current blog post from a random blog post slider grid element’ is closed to new replies.