• Resolved emeraldryan

    (@emeraldryan)


    This is a great plugin which has enabled me to link reviews (custom post type) to books (custom post type) on my website as seen below:

    function my_connection_types() {
    	if ( !function_exists( 'p2p_register_connection_type' ) )
    		return;
    	p2p_register_connection_type( array(
    		'name' => 'reviews_to_books',
    		'from' => 'review',
    		'to' => 'books',
    		'admin_column' => 'any'
    	) );
    }
    add_action( 'wp_loaded', 'my_connection_types' );

    However I have some books in different formats (paperback, hardback, ebook) which have a lot of identical information and need to share reviews.

    How do I create links between the same books in different formats to share reviews or do I even need to create multiple posts? I need to make it simple enough so that when a user submits a review for a book that it appears on all other books (in different formats) that are connected to it.

    Any help would be greatly appreciated.

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

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

    (@scribu)

    It seems to me that you should have a single ‘book’ post type plus a custom taxonomy, book-format, which would contain terms like ‘paperback’, ‘ebook’ etc.

    Then, based on the format, you could show different bits of information.

    This is exactly how the official post formats from WordPress are implemented.

    Thread Starter emeraldryan

    (@emeraldryan)

    Thanks for the prompt response.

    The issue with a format taxonomy is that I want to use a different featured image and [gallery] shortcode for the different formats.

    This is important because the website will also have games (another custom post type) in different formats (XBOX 360, PS3, etc) and when the user is filtering (with your Query Multiple Taxonomies plugin) by game format they need to see the correct box cover (featured image) and screenshots ([gallery] shortcode) for their format.

    I want to avoid duplication of data for the different formats and ideally share common fields and the related reviews.

    Thread Starter emeraldryan

    (@emeraldryan)

    I have been working through the examples in the wiki over the last few days and I’m not sure if what I’m trying to achieve is possible.

    I am currently making connections (books to books, reviews to books) as seen in the basic structure below.

    Hardback and ebook TO Paperback edition:

    [Book] The Lord of the Flies (Paperback)
    |-- [Book: The Lord of the Flies (Hardback)
    |-- [Book: The Lord of the Flies (ebook)

    Review TO Paperback edition:

    [Book] The Lord of the Flies (Paperback)
    |-- [Review] Awesome book
    |-- [Review] Timeless classic
    |-- [Review] My all-time favourite

    My idea is that the hardback and ebook editions check for a connected book (in paperback) and show the reviews from there. In other words they just check for connected reviews from the book that they are connected to.

    Is this type of query possible?

    Many Thanks

    Plugin Author scribu

    (@scribu)

    It doesn’t make much sense to connect reviews to specific book formats, IMO. How about having 3 post types:

    – book
    – book_format
    – review

    And these connection types:

    book <-> book_format
    book <-> review

    Actually, you could just use normal WP comments instead of the ‘review’ CPT.

    Either way, you will have to do two queries:

    1. get the book connected to a review
    2. get the formats connected to a book

    Thread Starter emeraldryan

    (@emeraldryan)

    Thanks for the reply. I think I understand what you’re saying so using my example (above) I would create the following:

    [book] The Lord of the Flies
    |-- [book_format] The Lord of the Flies (Paperback)
    |-- [book_format] The Lord of the Flies (Hardback)
    |-- [book_format] The Lord of the Flies (ebook)

    I presume the [book] posts would be private and I would only display the [book_format] posts publicly on the website.

    Have I understood this correctly?

    Plugin Author scribu

    (@scribu)

    It’s up to you if you display a book with all it’s formats or each book format individually. The connections are the same.

    The main idea is to be able to distinguish clearly between the two.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: Posts 2 Posts] Connecting post variations and reviews’ is closed to new replies.