Views plugin provides an API, making it easy to display Views output using PHP.
When you ask for help or report issues, make sure to tell us all related information about your View and the data that you want to display using the Views API.
Viewing 15 topics - 211 through 225 (of 416 total)
Problem:
The user would like to get a content template ID by slug.
Solution:
Content templates are just posts on an internal custom post type "view-template", you can get the post id by slug using the get_page_by_path function from WordPress.
Problem:
The user was trying to display products conditionally on the product type.
Solution:
The product type is a taxonomy and not a custom field, we should use a different shortcode to get the taxonomy value and use it on the conditional shortcode.
Problem:
The user would like to filter views by a custom field created by ACF. An address field as an example.
Solution:
If the field is simple it will work. If the field is complex and needs some logic by another plugin (e.g. a checkboxes field of ACF) it will likely not work as each plugin will have a particular logic/syntax and Toolset Views can't guess it. It can only guess Toolset Types complex fields.
The address field, provided by Toolset Maps, is an advanced field, and all I could imagine it to work with Views is a simple text input search or so, like for a single line field, but nothing else.
Note, managing with Types won't solve a thing in those cases, because you will simply lose the "other" plugins syntax and apply Types syntax on the field, that's all, so it is not really that you can "solve" this limitation with controlling the field by types, you can merely workaround it.
Finally, Toolset Views offers a way to hook into its query, you can always extend the query of a view with custom code. Check all views hooks.
Problem:
The user would like to use a different template for each WooCommerce product type.
Solution:
WooCommerce product types is a hidden taxonomy, but we can still pull the value of a product using Toolset.
We can assign ONLY ONE content template per custom post type(product). We can then use conditional shortcodes on product_type taxonomy and customize the content of the conditional shortcode, or create an unassigned content template per product type and use it inside the conditional shortcodes, check this example: