0

in oxygen I am using a repeater to show posts that have a certain relationship. The advanced query in the relationship is post_type = "custom post type1" and then I add another parameter that is post_in = ... I then go into the meta box field and select my relationship "custom post type1 to"

It then displays all posts in the "custom post type1" that have a direct relationship with the current post (a post within "custom post type2"). Works great until I need to use a bunch of repeaters on a single post.

I decided I would just go ahead and work on my own WP_Query to be able to set up pagination for each one instead of using a repeater. I also am looking at possible using piotnet grid for this as it has a custom query option that allows you to insert a wp_query array.

My problem is while I know how to do the array i don't know how to insert the relationship check.

array("post_type" => "custom post type1", "post_in" => "???");

Any help would be grateful as I have tried googling but can't seem to find anything (it is late for me so might be why I haven't found anything sorry if its painfully obvious as to what to do).

1 Answer 1

0

Alright so after waking up and actually thinking (lol) it was quite simple and I was way overthinking it.

In piotnet grid you can query a custom wp_query. I added this to the box

array(relationship => [
        //the meta box relationship id
        'id' => 'relationship-between-cpt1&cpt2',
        'from' => get_the_ID(),
    ])

in the preview window on piotnet grid it will look broke but once you put it into a post it works just fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.