|
Displaying 2 products on CPT page
Started by: sigerS
in: Types Community Support
Quick solution available
Problem: I have created a one-to-many relationship between my CPT Workshops (parent) and WooCommerce Products (child). I would like to display the related Products on the single Workshop page, and include a way to add the product to the cart and show the stock status of each Product.
Solution: Use Views to create a new View of Products, filtered by post relationship, where the post is a child of the current page.
In the Loop Output area, you can insert the Product title / link, an Add to Cart button, and a Product In Stock status indicator using the Fields and Views button, or by copy + pasting this code inside the wpv-loop tags:
[wpv-post-link]<br />
[wpv-woo-buy-or-select]<br />
[wpv-conditional if="('[wpv-post-field name='views_woo_in_stock']' eq '1' )"]In stock[/wpv-conditional]
[wpv-conditional if="('[wpv-post-field name='views_woo_in_stock']' eq '1' )" evaluate="false"]Out of stock[/wpv-conditional]
Relevant Documentation:
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/
|
|
2 |
6 |
6 years, 10 months ago
sigerS
|
|
Update types custom field in parent post from custom field in child post
Started by: culturaI
in: Toolset Professional Support
Quick solution available
Problem:
I have:
parent post type: "contatto"
child post type "corso"
custom field "data-inizio corso" in child "corso"
custom field "data-ultimo-corso" in parent "contatto"
I would like that when filled "data-inizio-corso" the value is copied in "data-ultimo-corso" updating or creating the post.
Solution:
Types plugin is using a custom field "_wpcf_belongs_[parent-slug]_id" to store the parent post ID, for example, if the parent post type is using slug "contatto", then in single child "corso" post, there is a hidden field "_wpcf_belongs_contatto_id", the filed value is parent post ID, so if "$post_ID" is a child "corso" post ID, you can get the parent "contatto" post ID with PHP codes:
$contatto_id = get_post_meta($post_ID, '_wpcf_belongs_contatto_id', true);
Then use the $contatto_id to update the custom field "data-ultimo-corso" to what you want.
Relevant Documentation:
|
|
2 |
4 |
6 years, 10 months ago
Luo Yang
|
|
Show Parent Field in the Child Single Post
Started by: viktorI
in: Toolset Professional Support
Quick solution available
Problem:
How to show fields from parent posts when creating a PHP template for child posts?
Solution:
When you create templates with Views or Layouts you can set the context to the parent post when outputting fields with the id shortcode attribute.
You can employ a similar technique when directly editing PHP templates with the types_render_field function, passing the ID attribute as an array:
types_render_field( 'contact-info', array( 'id' => '$twi-vendor' ) );
Relevant Documentation:
https://toolset.com/documentation/customizing-sites-using-php/displaying-parent-posts/
|
|
2 |
4 |
6 years, 10 months ago
Nigel
|
|
Clarification on Repeating Fields Groups
Started by: culturaI
in: Types Community Support
Quick solution available
Problem:
In my site i have custom post type contacts, every contact can attend to 1 or more courses (usually 1 to 5). We'll plan to have 10.000-30.000 contacts.
Instinctively i was thinking to use method of advanced custom field and add repeater fields (course type, level, date, ecc...)
I read also some post on this forum, and some article from toolset documentation on group fields (many to many relationship or one to many)
I'm a little confused on options and my question is:
in my case what is the correct option i should use with toolset (especially from database point of view)?
Solution:
It depends on your settings.
I assume we are talking about this case:
Two custom post types:
- contacts
- courses
One "courses" post can connect with multiple "contacts" posts
One "contacts" post can connect with multiple "courses" posts
If it is, I suggest you try to setup many-to-many relationship between custom post types:
- contacts
- courses
see our document:
Relevant Documentation:
https://toolset.com/documentation/user-guides/many-to-many-post-relationship/
|
|
2 |
10 |
6 years, 10 months ago
Luo Yang
|
|
Not possible to edit custom fields groups using Types and Views betas
Started by: carmenC
in: Toolset Professional Support
Quick solution available
Problem:
It is not possible to edit custom fields groups.
This is on a site with betas of Types and Views, and Access.
Solution:
The Types and Views betas that are part of the post relationships update do not currently work with other Toolset plugins reliably and are intended only to be used together. This limitation will be removed when they move out of beta.
|
|
2 |
5 |
6 years, 10 months ago
carmenC
|
|
Relationships Download
Started by: abdullahA-6
in: Toolset Professional Support
Quick solution available
Problem:
Where to download the Toolset betas?
Solution:
The beta versions are available from your account downloads page: https://toolset.com/account/downloads/
You'll need to switch to the beta track, as shown in the screenshot below.
|
|
2 |
2 |
6 years, 10 months ago
Nigel
|
|
Relation Many-to-Many and "multi" chaining
Started by: thibautF
in: Toolset Professional Support
|
|
2 |
11 |
6 years, 10 months ago
thibautF
|
|
How to see grandchild custom post with information of his parent and grandparent
Started by: Rostislav Avtodiychuk
in: Toolset Professional Support
Quick solution available
Problem: I have 3 post types in a child -> parent -> grandparent hierarchy relationship. I would like to display information about the parent and grandparent in the child post.
Solution:
Access information about a parent post, you can use the following syntax:
[wpv-post-title id="$parent-type-slug"]
So for example, if your city post type slug is "city", then your code will be:
[wpv-post-title id="$city"]
To access information about a grandparent post, you can use a Content Template to change the context by passing in the $city operator for the id attribute:
[wpv-post-body id="$city" view_template="your-content-template-slug"]
Inside that Content Template, you can then use the parent post technique we used before to access the grandparent country post. If your country post type slug is "country" then your code in the Content Template will be:
[wpv-post-title id="$country"]
Relevant Documentation:
https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/
https://toolset.com/documentation/user-guides/displaying-fields-grandparents/
|
|
2 |
3 |
6 years, 10 months ago
Rostislav Avtodiychuk
|
|
Setting Parent that’s a different CPT
Started by: Chris
in: Toolset Professional Support
Quick solution available
Problem:
I have two post types, State and City. We have a top Page, then a child of State, then a child of City.
Could you help me figure out how to get the "Parent" option to show the correct items? When I edit a State, "Parent" should show all Pages. Then, when I edit City, "Parent" should show all States.
Currently, it is only showing its own CPT.
Solution:
I suggest you setup the post type "State" as parent post type of "City", then when you edit a single "City" post, you will be able to setup it's parent "State" post, see our document:
Creating Post Type Relationships
https://toolset.com/documentation/user-guides/creating-post-type-relationships/
Relevant Documentation:
https://toolset.com/documentation/user-guides/creating-post-type-relationships/
|
|
2 |
4 |
6 years, 10 months ago
Luo Yang
|
|
Layer problem
Started by: olivierB-4
in: Toolset Professional Support
Quick solution available
Problem:
There is a z-index problem with the relationship dialogs, making it impossible to select the required content.
Solution:
This arises from a conflict with the Slider Revolution plugin by Artbees.
They have a problem with their CSS which only they can fix.
|
|
2 |
5 |
6 years, 10 months ago
Nigel
|
|
using stored post id to view related posts
Started by: Anthony
in: Toolset Professional Support
Quick solution available
Problem:
The issue here is that the customer had stored some id in a custom field of another CPT but wanted to know if its possible to use Views to filter on his secondary view to show his Post Parent essentially.
Solution:
In this scenario we will be using Products and Beans where products has the custom field that stores the ID of the beans.
So essentially when you're on the bean's page you want to display the products?
In this case you will need to create a view for the product cpt and then add a filter for the custom field that has the bean id in it.
Then set that field so that the value is retrieved using a shortcode attribute. Next all you need to do is to add the view to the bean page and then pass the ID of the page into the view like this.
[wpv-view name='my-view' my_value='[wpv-post-id]']
|
|
2 |
3 |
6 years, 10 months ago
Anthony
|
|
Post relationship as a standalone plugin
Started by: enricoC-2
in: Toolset Professional Support
|
|
3 |
7 |
6 years, 10 months ago
Minesh
|
|
How to make related post author field required
Started by: JosV9233
in: Toolset Professional Support
Quick solution available
Problem:
I have a relation with post author and a custom field set. I can make every field required (I do not need to, but I can), except for the post author field.
As the client is testing it now an empty line appeared in the dropdown. I have no direct contact with the client so I can not ask him what happened, but I think making the field required could avoid empty lines in the future. Maybe I am thinking wrong, but now you can make a new order without selecting the author.
Solution:
How do you setup the post author field? is it a CRED generic field?
If it is, you can add argument "required" in the shortcode [cred_generic_field], for example:
[cred_generic_field type='select' ...]
{
"required":1,
...
}
[/cred_generic_field]
See screenshot https://cdn.toolset.com/wp-content/uploads/2018/01/604177-required.JPG
Relevant Documentation:
|
|
2 |
5 |
6 years, 10 months ago
Luo Yang
|
|
Auto assign many-to-many relationship to a parent
Started by: culturaI
in: Types Community Support
Quick solution available
Problem: I have a CRED form that allows users to create child posts. I would like to predefine the parent post so the User does not need to select it.
Solution: If you want to predefine values for a CRED field, you have 3 basic options:
1. Provide the value as a URL parameter. Link to the page containing the CRED form using the URL value to supply the correct parent ID, something like yoursite.com/cred-form-page?contatti=1234. Then update your parent contatti CRED field and add the urlparam attribute:
[cred_field field='_wpcf_belongs_contatti_id' post="iscrizioni" urlparam="contatti"]
This would predefine the contatti with ID 1234 as the parent of the new post.
2. Provide the value in the value attribute. You can use a hard-coded number or a shortcode in the value attribute to predefine the parent contatti ID:
[cred_field field='_wpcf_belongs_contatti_id' post="iscrizioni" value="1234"]
3. Write your own custom code with JavaScript and/or PHP. Note that there is no CRED JavaScript API, so the amount of support we can provide for custom JavaScript is fairly limited.
In all 3 cases, you can wrap the field in a hidden div if you want to hide the field from your Users:
<div style="display:none;">
[cred_field ...]
</div>
Relevant Documentation:
https://toolset.com/documentation/user-guides/cred-shortcodes/#cred_field
|
|
2 |
6 |
6 years, 10 months ago
Christian Cox
|
|
Pass URL parameter to target page
Started by: Rostislav Avtodiychuk
in: Toolset Professional Support
Quick solution available
Problem: I would like to add a URL parameter to a link's destination URL so I can use that URL parameter as a View filter.
Solution: In a loop, you can use Views Shortcodes to build the HTML for a link tag with a URL parameter like this:
<a href="[wpv-post-url]?country-id=[wpv-post-id]">[wpv-post-title]</a>
Relevant Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/
|
|
2 |
2 |
6 years, 10 months ago
Christian Cox
|