WordPress.org

Ready to get started?Download WordPress

Forums

Posts 2 Posts
[resolved] Using posts to posts with custom post types (6 posts)

  1. sazzlemajazzle
    Member
    Posted 2 years ago #

    Firstly, thank you. This plugin is really helpful!

    I'm trying to use it to do something, but I'm not sure if what I'm trying to do is possible. My set-up is this: I've got a custom post type for businesses, and another for events. I want to associate events with businesses, so that when on the page for a business, I can display related events.

    So far I've followed your 'basic usage' and that's all good, I can pull through the title of the event. However, I have custom fields for my custom post type of events - for example, event location. On my event pages I'm displaying these using (for the example of event location) <?php echo get_post_meta($post->ID, 'event-location', true); ?> Is there a way that I can pull this information through and display it on the page for a business along with the event title?

    Please let me know if you need any more info to answer my question.

    Thanks again!
    Sarah

    http://wordpress.org/extend/plugins/posts-to-posts/

  2. scribu
    Member
    Plugin Author

    Posted 2 years ago #

    You can display any information you want. It's just a loop:

    https://github.com/scribu/wp-posts-to-posts/wiki/Basic-usage

  3. robheath
    Member
    Posted 1 year ago #

    I used the following

    function my_connection_types() {
    	// Make sure the Posts 2 Posts plugin is active.
    	if ( !function_exists( 'p2p_register_connection_type' ) )
    		return;
    
    	p2p_register_connection_type( array(
    		'name' => 'Movie Trailer_to_Movie Hub',
    		'from' => 'Movie Trailer',
    		'to' => 'Movie Hub'
    	) );
    }
    add_action( 'wp_loaded', 'my_connection_types' );

    But it stills show up as the following:

    "Posts ↔ Posts (Connected Posts)"

    The box doesn't appear in my custom post type editor pages. But still shows up in the default post type editor. What am I doing wrong?

    My post types exist, I registered them in the functions file.

    Thanks for your help.

  4. robheath
    Member
    Posted 1 year ago #

    I also tried using "movie_trailer" and "movie_hub"

  5. scribu
    Member
    Plugin Author

    Posted 1 year ago #

    @robheath: Hijacking a thread like that is impolite. Please open a new one.

  6. robheath
    Member
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic