Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Brecht

    (@brechtvds)

    Hi James,

    Relations are saved as post metadata. There are 2 keys you can look for: crp_relations_from and crp_relations_to.

    How do you want to display them exactly? We plan on updating the plugin soon so maybe we can provide something you can use.

    Kind regards,
    Brecht

    Thread Starter RenaissanceJames

    (@renaissancejames)

    Hi Brecht,

    Basically I have created 6 different views to display related posts/pages etc. and use shortcode ultimate to create these layouts.

    When someone adds a post/page they can choose the related posts and which layout to use and this then displays, to do this I need it to bring in related posts, I can set it up so that they have a select field and they choose the posts, but what I love about your plugin is that they enter a relationship on one post and it displays on the related post as well.

    Is there a filter in the plugin that can be called already? or would I need to create my own filter?

    Cheers
    James

    Thread Starter RenaissanceJames

    (@renaissancejames)

    I have worked out a way to get this out us get_post_meta and a couple of foreach.

    Included below incase anyone else would like this.

    $array = get_post_meta($post_id, "crp_relations_to");
    			foreach ($array as $row) :
    				foreach ($row as $key => $sub_array) :
    					$keys .= $key . ', ';
    				endforeach;
    			endforeach;
    			echo $keys;
    Plugin Author Brecht

    (@brechtvds)

    This should work as well and requires only one loop:

    $relations = get_post_meta( $post_id, 'crp_relations_to', true );
    
    foreach( $relations as $related_post_id => $relation ) {
        // Do what you want with $related_post_id
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Get a list of Post ID's to be used by another plugin’ is closed to new replies.