-
AuthorPosts
-
September 22, 2022 at 10:12 pm #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.
September 23, 2022 at 12:03 am #1366053September 23, 2022 at 11:43 am #1366094Hi,
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,
IsmaelSeptember 23, 2022 at 4:54 pm #1366151Hi 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.
September 23, 2022 at 5:02 pm #1366153Hello, please see screenshots below:
Filter settings: https://savvyify.com/img/image/filter-offset-auto.cund
Page layout: https://savvyify.com/img/image/blog-post-layout.cMsy
Single post with blog posts sidebar: https://savvyify.com/img/image/article-page-offset-auto.cYVnSeptember 24, 2022 at 5:01 pm #1366212can 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?
September 28, 2022 at 10:09 am #1366675Hi,
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 -
AuthorPosts
- You must be logged in to reply to this topic.