Tagged: duplicate post
-
AuthorPosts
-
February 10, 2016 at 9:17 am #580903
Hi,
In the blog section of my website, at the bottom of each blog post, I have a “You May Also be Interested in…” section where I use the Blog Post element to provide 3 additional blog post recommendations and encourage visitors to stay on the site.
Naturally, I want to exclude recommending visiting the blog post they’re currently on (eg. I don’t want to recommend looking at “10 Things ABC” if they have just read the blog post “10 Things ABC”.
I’ve experimented with a few different taxonomy configurations to try find a work-around, however since some of the blog posts are in the same category, I cannot achieve what I am trying to do.
Is there a way I am able to exclude a specific blog post, or any alternative solution to this problem?
Thanks.
February 13, 2016 at 3:14 pm #582730Hey!
What element are you using to show the related posts? some elements have an Offset option that lets you prevent duplicates – http://screencast.com/t/FRA0HMqcIxsn
Cheers!
JosueFebruary 13, 2016 at 4:43 pm #582749Hi Josue,
I am using the Blog Post element, and yes, that option does exist.
It has worked on one of the posts, however not on the other two.
It is not clear what setting I should be putting it to, as setting it to “set offset automatically”.
I believe the problem is that on Blog Post #2 for example, I obviously wish to exclude recommending the 2nd blog post (ie. the current post). However, I still wish to recommend Blog Post #1 (which comes before Blog Post #2).
Please advise how I am supposed to use this feature.
Thanks.
February 13, 2016 at 4:49 pm #582750Hi,
“Do not allow duplicate posts in the entire page” is the option you should choose, can you please create me a WordPress administrator account? post it here as a private reply.
Regards,
JosueFebruary 13, 2016 at 4:54 pm #582753Hi Jouse.
Please see below.
Thanks.
February 15, 2016 at 3:46 pm #583507Hey!
I can’t see any duplicated posts on the links you have provided. Could you fix it already?
Regards,
AndyFebruary 15, 2016 at 5:24 pm #583602There’s something very odd going on.
I can now see that there are no duplicates, but this wasn’t the case yesterday and I didn’t make any changes.
Also, now on one of those 3 pages, there are no recommended blog posts, despite having no made no changes and checked to ensure that the Blog Post element was still active on the page.
I have included the URL in the Private Content section.
Please advise why this is now not displaying?
I am also confused as to how this problem simply corrected itself after having spent a considerable time trying to fix it and making no additional changes?
February 15, 2016 at 6:00 pm #583642I did add a code yesterday but couldn’t notify you here because i lost internet connection, nevertheless here’s the code that did the trick:
add_filter('avia_post_slide_query', 'enfold_customization_query_custom'); function enfold_customization_query_custom( $query ) { global $post; if ( is_single() ) { $query['post__not_in'] = array($post->ID); return $query; } }
It seems however to have affected those Posts you mention, i’m investigating that right now.
Best regards,
JosueFebruary 15, 2016 at 6:17 pm #583654OK i found the error, in order to get the code working properly the Blog post element must not have offset activated – http://screencast.com/t/SSpFd1ekaLN
February 15, 2016 at 6:22 pm #583663I’m confused –
What does the code do? (it was never explained).
Do I need to do anything with that code?
And finally, how do I resolve my original problem – which is wanting simply to display three recommended blog posts and not having the same blog post that the visitor has just read be one of the recommended posts?
Thanks,
EvianFebruary 15, 2016 at 6:52 pm #583688The code hooks into the post grid logic and removes the current post from the query (it only happens when a single post is being shown). Review your Posts again, you will see it working.
If none Posts are showing make sure you to reset the Offset value here – http://screencast.com/t/SSpFd1ekaLN
Regards,
JosueFebruary 16, 2016 at 4:51 am #583874Hi Josue,
I have checked and everything appears to be working as I wish it to.
I am still not clear on what you did to fix it, but thank you.
Can you please confirm that there is nothing further I am required to do now to ensure it remains fixed as is?
Thank you,
EvianFebruary 17, 2016 at 12:37 pm #584640Hi!
well, if it’s working fine for you, then there is nothing do for you but enjoying the theme :). Let us know if you still need help with this topic and feel free to open a new ticket for a new issue/question related to the theme. We are happy to assist you.
Best regards,
AndyFebruary 17, 2016 at 1:00 pm #584662Hi!
Glad it’s working, there’s certainly nothing more to add, remember that the code is located in Plugins > Edit functions, which is attached to the Functionality plugin i had to install because you didn’t use a child theme.
Cheers!
JosueSeptember 10, 2016 at 5:26 pm #684527Hello, I have been having the same issue as the person in this thread.
I am trying to follow the steps, however when I install the Functionality plugin, i click on “edit funtions” and it says this page does not exist. Is there something else I can do to remove duplicate blog posts?
Best,
Abe
September 10, 2016 at 6:29 pm #684531December 13, 2016 at 3:46 pm #723761Hi,
I’m having the same problem here, I tried the above code:
add_filter(‘avia_post_slide_query’, ‘enfold_customization_query_custom’);
function enfold_customization_query_custom( $query ) {
global $post;
if ( is_single() ) {
$query[‘post__not_in’] = array($post->ID);
return $query;
}
}Seems to be working with grid layout only, but my blog layout doesn’t show up (which is also a grid layout).
any idea what could be the problem ?Thanks
EDIT:
Hi,
a friend helped and this fixed the problem:
add_filter(‘avia_post_slide_query’, ‘enfold_customization_query_custom’);
function enfold_customization_query_custom( $query ) {
global $post;
if ( is_single() ) {
$query[‘post__not_in’] = array($post->ID);
return $query;
}
else
return $query;
}Thanks !
- This reply was modified 8 years ago by sam-to-911. Reason: Solved
December 14, 2016 at 7:51 am #724159 -
AuthorPosts
- You must be logged in to reply to this topic.