Tell us what you are trying to do?
I've a relationship with CPTs "publicacio" and "coleccs", something like books and authors. I want to show the author name(coleccs) in the single page for publicacio (book).
When I put in the "content template " a toolset single field, in the source I can't see the "Parent: <post type name> option"
Is there any documentation that you are following?
https://toolset.com/lesson-placement/lesson-placements-1824625-1727273/
https://toolset.com/course-lesson/using-post-reference-field-to-set-up-one-to-many-relationships/
Is there a similar example that we can see?
relation like books and authors
Hello,
I assume we are talking about many-to-many relationship between post types "publicacio" and "coleccs", one "publicacio" post can connect with multiple "coleccs" posts, in the single "publicacio" post, you can follow our document to display the realted "coleccs" posts information:
https://toolset.com/course-lesson/displaying-related-posts/#displaying-many-related-items
Yes, the relationship is many to many (Coleccs [*] << Coleccs Publicacions >> Publicacions [*])
In the tutorials when creates a single page for a CPT appears the related CPT, but I can't see it and then I can't use the "coleccs" fields values to show it in the page.
I've made a video for you:
hidden link
thanks
Thanks for the video, in the content template you mentioned in the video, you can add a view block:
- Query "coleccs" posts
- Filter by post type relationship between "publicacio" and "coleccs"
- In view's loop, display the "coleccs" information(custom fields)
See the document I mentioned above:
https://toolset.com/course-lesson/displaying-related-posts/#displaying-many-related-items
Section "Displaying many related items"
If you need more assistance for it, please provide a test site with the same problem, I can setup a demo for you
It needs a child post view, I have done below modifications in your website:
1) Dashboard-> Toolset-> Views
Create a new post view "show fields from a post relationship":
hidden link
- Query "Col·leccions" posts
- Filter by:
Select posts in a Publicacions Col·leccions relationship that are a related to the current post in the loop.
- In view's loop, display "Col·leccions" post link
2) Edit the home page,
hidden link
In view's loop, display above post view
Test it in frontend, it works fine:
hidden link
Please check if it is what you want, thanks
Hi Lou,
you have done this with a view, but as I explain in the single page I need this field as a "inline field", not a view, to use it inside a paragraph.
I need to can use the fields as follows:
1) The collection [FIELD COLLECTION NAME] includes the book [FIELD PUBLICACIÓ NAME] number [FIELD PUBLICACIO NUMBER] etc...
2) in the home page, Col·lecció : [FIELD COLLECTION NAME] , in a line no as a list.
thanks,
I have done below modifications in your website:
1) Edit the post view "show fields from a post relationship"
hidden link
a) In section "Loop Editor", click button "Loop Wizard", choose option "Unformatted", and display the post title:
[wpv-item index=1][wpv-post-body view_template="loop-item-in-show-fields-from-a-post-relationship"]
[wpv-item index=other], [wpv-post-body view_template="loop-item-in-show-fields-from-a-post-relationship"]
you can add other post fields into the content template "Loop item in show fields from a post relationship"
b) enable option "Disable the wrapping DIV around the View"
2) Edit the page "Home", find and edit the view block, after text "Col·lecció:", display above post view's shortcode:
[wpv-view name="show-fields-from-a-post-relationship"]
Test it in frontend:
hidden link
It works fine, and display the the post view as inline text
It is only a demo for your reference.
More help:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-view
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-item
Thanks Lou, this is better but the field is still out of paragraph and this causes a new line as you can see in the home page (I've changed from 3 columns to 1 column to show the issue).
I would like to use the button "inline field". Please look the attached image.
Is this possible with a field in a CPT relationship?
Thanks for the screenshot, I have done below modifications in your website, edit the home page:
hidden link
Replace the paragraph block with a custom HTML block, with the same code:
ol·lecció: [wpv-view name="show-fields-from-a-post-relationship"]
It should be able to remove the extra paragraph.
For the button "inline field", it won't work for many-to-many relationship, it only work for one-to-many or one-to-one relationships
My issue is resolved now. Thank you!