Okay
  Public Ticket #3399362
Related posts
Closed

Comments

  •  1
    MM-BS started the conversation

    Hey there

    I am using posts mostly to display photos. So my posts do usually not have text as content and consist only of a title, a photo with the location in the photo's caption and tags. 
    When I activate the related posts option on single sites, always the same, maybe 10 different photos, show up as related under every post and they are not really related to the current post. I have the option currently activated, so if you surf through my posts you will see what I mean. I don't know what the criteria are to select related posts, but can there be anything changed so that the title or caption or tags are considered to select these related posts? Or however that not always the same photos show up? 

    Thanks for your help : Matthias   

  • [deleted] replied

    Hi Matthias,

    Our related posts functions grabs 10-12 different related posts for a post and caches them for a day and randomizes the sort that displays them.

    If you want to disable that caching and each time user visits the query is executed:

    add_action( 'setted_transient', function ( $transient ) {
        if ( false !== strpos( $transient, 'kalium_related' ) ) {
            delete_transient( $transient );
        }
    } );

    Please note that if post has assigned category or tag, the related posts will look only in those terms/taxonomies.

    You can disable this but it currently needs to do it in the code, before that let me know this the above solution works for you.

  •  1
    MM-BS replied

    Hi Arlind

    Thanks for your answer and sorry for my late reply - I was traveling the last days. 

    If I understand it right, the mentioned code goes in my child theme's function.php, right? 

    I tried that, but I did not notice any difference in the behavior - still the same related posts come up.

    It's no problem for me to change something in the code, if you tell me what and where.

    Best regards : Matthias


  • [deleted] replied

    Hi Matthias,

    I hope you had a wonderful time on your vacation.

    Yes, the code was placed properly however I am not sure if it was working properly because you have many posts and the related posts plugin is designed to work with the posts of the same categories/tags the post is attached to. I have removed this  functionality by adding this code "false &&":

    medium
    (view large image)

    Now the related posts are not limited to the current category but searches all categories.

    Does this work for you?

  • [deleted] replied

    Hi Matthias,

    I have just added a better solution and it randomizes the query rather than excluding same category:

    medium
    (view large image)

    Now the related posts are fully randomized.

  •  1
    MM-BS replied

    Hi Arlind

    Thank you so much for your help. Yes, now it works perfectly!

    Kind regards : Matthias


  • [deleted] replied

    Happy to hear that this is now resolved.

    Have a nice day!

    I will set this ticket as closed from here.