Views is a WordPress plugin that lets you easily display content on your website's front-end in any way you choose.
Views User Guides include detailed documentation for creating lists of content, templates for content and archive page and also explain how to create parametric searches for any content type.
When you ask for help or report issues, make sure to tell us the versions of the Toolset plugins that you have installed and activated.
Viewing 15 topics - 1,516 through 1,530 (of 2,104 total)
Problem: I have created a Fields and Text block and inserted some text, including a wpv-post-date shortcode. I would like to use a different date format in the secondary language site, but I cannot see the date shortcode in the translation editor so I cannot translate the format.
Solution: In this case the original date shortcode did not include a format attribute. If you want to translate the date format in a wpv-post-date shortcode, you must first include the format attribute in the original shortcode:
Problem: I have two custom post types - Articles and Authors - connected in a many-to-many (m2m) post relationship. I have created a View of Articles posts, and in the list of Articles I would like to include information about the related Author.
Solution: Any time you want to display information from the "many" side of a post relationship, you'll need a View. Since the relationship between Articles and Authors is a many-to-many relationship, you'll need a nested View structure to display a list of Articles and the related Authors for each Article.
Nested View creation is not directly supported in the Block Editor, so you can use the legacy View editor if necessary. For the inner View, use a post relationship Query Filter configured with the Articles - Authors M2M relationship selected, showing items as related to the current post. You can place the inner View in the loop of the outer View using a wpv-view shortcode.
Problem: I have a View of custom posts that displays a map with markers, using a distance filter and sorting results by distance. In some cases the distance center is set by a URL parameter, and in others, it is set by a shortcode attribute. I have implemented some custom code in a wpv_view_settings filter to toggle between the shortcode attribute and the URL parameter. In the cases where distance center is set by a shortcode attribute, I am using another custom shortcode to get the User's predicted zip code. That shortcodes an external service to get a predicted zip code based on the User's IP address. The custom zip code service seems to be working correctly, and the results of the View seem to be accurate.
However, in the cases where this zip code shortcode is used to set the View's distance Query Filter by shortcode attribute, the View consistently causes the page generation time to jump by 3 or more seconds. I would like to try to optimize the page load time as much as possible.
Solution: In this case, testing revealed that using the custom zip shortcode inside a wpv_view_settings filter callback was the source of the delay in page generation, for some reason not fully understood. Replacing that shortcode with a hard-coded zip code resulted in a page generation time just a fraction of a second higher than the page without the View present at all.
Optimization of the zip code shortcode is necessary to prevent the latency seen in page generation time.
Problem: If no items are found in a View of WooCommerce Orders, I would like to automatically refresh the View results after a set amount of time.
Solution: There is no automatic feature for refreshing View results, nor is there a true JavaScript API for Views, but you could achieve something similar by reloading the current page in a setTimeout function added to a script tag in the wpv-no-items-found block of the View, for example:
This will reload the current page after 5 seconds if no results are found in the View. That loop of refreshing every 5 seconds would continue until results exist.