Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Ajay

    (@ajay)

    Is it the same posts for all posts on your site?

    Will need the URL to check.

    Thread Starter yiannis_

    (@yiannis_)

    Thanks for the reply.

    The issue was that $post->ID was always returning the same ID in the following section. I managed to fix this by adding:

    // Retrieve the list of posts
    if (!$is_widget) {
    $results = get_crp_posts_id( array_merge( $args, array(
    ‘postid’ => $post->ID,
    ‘strict_limit’ => TRUE,
    ) ) );

    }

    if ($is_widget) {
    $page_object = get_queried_object();
    $page_id = get_queried_object_id();
    $results = get_crp_posts_id( array_merge( $args, array(
    ‘postid’ => $page_id,
    ‘strict_limit’ => TRUE,
    ) ) );

    }

    A url from the site here

    Plugin Author Ajay

    (@ajay)

    Can you tell me which lines of the code did you change?

    I just checked out your site, but unfortunately, I can’t find the exact position of the related posts due to the language difference.

    Thread Starter yiannis_

    (@yiannis_)

    This is in line 70 in contextual-related-posts.php.
    The widget is on the RHS column of the website http://prntscr.com/3328jp
    Y.

    Plugin Author Ajay

    (@ajay)

    Understood. The idea of $post is to fetch the global post ID and then find related posts for it.

    Is there something that is interfering with this that is forcing you to set the get_queried_object_id?

    Thread Starter yiannis_

    (@yiannis_)

    Not that I can think of. Having said that, I had an issue with get_queried_object_id on another website on this server.

    Could this be a server setting that was to do with the way it is registering globals?

    Y.

    Plugin Author Ajay

    (@ajay)

    It might be the case, but it definitely is well above my PHP and server knowledge.

    Do you know if the plugin works well when you’re using the inline post option and not the widget?

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Widget keeps showing the same posts’ is closed to new replies.