Views is a WordPress plugin that lets you easily design the display of single pages using content templates. You can also include any field belonging to the content in your templates, without writing PHP code.
When you ask for help or report issues, make sure to tell us what you have created so far and what you want to achieve.
Viewing 15 topics - 1,876 through 1,890 (of 2,089 total)
Problem: After updating Toolset plugins, a Content Template created with Divi is broken. The sidebar that was appearing on the right side is now below the main content.
Solution: Check the markup of the page to eliminate any extra closing div tags.
Problem: I have a repeatable field group that contains several fields. I would like to use a conditional to test if any of the RFG has a value in one specific field. If so, I would like to show some text in a header. If not, I would like to hide the header.
Solution: One way to accomplish this in Toolset alone is with a View of the Repeatable Field Group. Add a post relationship query filter, so that the parent post is set by the current page ( or the current post in the loop if you're displaying the main post in a View ). Then add a Query Filter for the custom field (or fields), and check that the field value is not empty. Set the limit to 1 post, since all you need to know is whether or not one exists. In the wpv-items-found section of the loop, add the heading information you want to display. In the wpv-no-items-found section, delete the text message. This View is now effectively a conditional that tests if any related RFG have content in the custom field(s) in your query filter.
If you need something more flexible, a custom shortcode approach is probably more practical. You can use the toolset_get_related_posts API to get all the RFGs for a specific post, then loop over them and inspect their post meta values. I can help with toolset_get_related_posts if you need more information. Basically an RFG is treated as a child of the main post. The slug of the relationship is identical to the RFG slug.
Problem: I have a View showing the repeatable field groups (RFGs) for a specific post. Inside the View of RFGs, I would like to create a conditional that tests whether or not the checkbox custom field in the parent post is checked.
Solution:
Use the @repeatablefieldgroupslug.parent syntax in the id attribute of the wpv-post-field shortcode to access the raw value of the checkbox custom field in the parent post. A checkbox field will normally have the value 1 if checked, so your conditional will look like this:
Problem: I would like to hide a tab when its tab panel contents are empty.
Solution: There's no way to apply conditional logic to a Layouts tab cell like this, but if you know how to create tabs using CSS / HTML / JavaScript you may be able to implement conditional HTML around each tab and tab panel.