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

    Hello, I have an issue with the Blog Posts widget displayed in the sidebar for a single post. The desired functionality is to display the 3 most recent articles, excluding the one currently displayed.

    In the Filter section of the Blog Posts widget configuration, I have selected “Do not allow duplicate posts on the entire page”. However this doesn’t seem to be working — the widget still includes the currently displayed article in the list of blog posts. The workaround so far is to set the offset to 1, but the value will have to be manually set for each post.

    Why is the auto offset feature not working as expected? This thread — https://kriesi.at/support/topic/remove-current-post-from-blog-grid/ — offers a solution using functions.php, but there’s no explanation as to why the auto increment option isn’t working.

    #1366053

    You can see the problem here

    Screenshot-1

    #1366094

    Hi,

    Thank you for the inquiry.

    The screenshot above is not available. Please try to use imgur, savvyify or dropbox instead. How did you add Blog Posts element in the widget?

    Best regards,
    Ismael

    #1366151

    Hi can you try refreshing your page or dropping shields if you’re using Brave browser? The screenshot shows up for me when viewing this page no problem.

    #1366153
    #1366212

    can you try this snippet in your child-theme functions.php:

    function ava_exclude_current_post($query) {
      if(is_single()){  
        $exclude = avia_get_the_ID();
        $query->set( 'post__not_in', array($exclude) );
      }
    }
    add_action('pre_get_posts', 'ava_exclude_current_post');

    i don’t know if the sidebars are affected on this – but give it a try.

    EDIT : ok i see that you linked to that post – so have you tried it?

    #1366675

    Hi,

    Thank you for the update.

    Please note that the Offset Number will only affect other posts element in the same page. The current post will not be included in the offset. If you want to exclude the current posts from the list, you can try the filter above provided by @Guenni007.

    Best regards,
    Ismael

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