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

  1. Sarah
    Posted 4 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!


  2. scribu
    Plugin Author

    Posted 4 years ago #

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


  3. robheath
    Posted 4 years 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' ) )
    	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
    Posted 4 years ago #

    I also tried using "movie_trailer" and "movie_hub"

  5. scribu
    Plugin Author

    Posted 4 years ago #

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

  6. robheath
    Posted 4 years ago #

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Posts 2 Posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic