• Hi,

    I’m looking for a little bit of help… ??

    My objectif is to show connected posts to a custom post filtering on meta query (custom field).

    Here is the initial code : https://pastebin.com/Thhe6EbR

    The problem stars on line 33. Multiple data are displayed. I need to show just one data. I already do this on single custom post but the same code do not work on a taxonomy page.

    I’m using this piece of code just after line 30 :


    $connected = new WP_Query( array(
    'connected_type' => 'saisons_to_sejours',
    'connected_items' => get_queried_object_id(),
    'nopaging' => true,
    'meta_query' => array(
    'relation' => 'AND',
    array(
    'key' => 'date_debut',
    'value' => $today,
    'compare' => '<='
    ),
    array(
    'key' => 'date_fin',
    'compare' => '>=',
    'value' => $today,

    ),
    )

    ) );

    Not sure I’m clear in my explanations…

    https://www.ads-software.com/extend/plugins/posts-to-posts/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author scribu

    (@scribu)

    So, you’re saying the WP_Query call works fine on other templates.

    The issue is that, on category template, get_queried_object_id() returns the current category, not a post.

    You just need to replace it with $post, like you did in your initial code.

    Thread Starter Aurélien Denis

    (@maigret)

    You’re the King! Lost one entire day looking for my error. ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Posts 2 Posts] Loop on loop – taxonomy template’ is closed to new replies.