Viewing 18 posts - 1 through 18 (of 18 total)
  • Author
    Posts
  • #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.

    #582730

    Hey!

    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!
    Josue

    #582749

    Hi 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.

    #582750

    Hi,

    “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,
    Josue

    #582753

    Hi Jouse.

    Please see below.

    Thanks.

    #583507

    Hey!

    I can’t see any duplicated posts on the links you have provided. Could you fix it already?

    Regards,
    Andy

    #583602

    There’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?

    #583642

    I 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,
    Josue

    #583654

    OK 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

    #583663

    I’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,
    Evian

    #583688

    The 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,
    Josue

    #583874

    Hi 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,
    Evian

    #584640

    Hi!

    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,
    Andy

    #584662

    Hi!

    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!
    Josue

    #684527

    Hello, 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

    #684531

    Hi!

    you could also enter this code into functions.php.

    Best regards,
    Andy

    #723761

    Hi,

    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 7 years, 4 months ago by sam-to-911. Reason: Solved
    #724159

    Hi @sam-to-911,

    Great, glad you got it working and thanks for sharing :-)

    Best regards,
    Rikard

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