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 - 31 through 45 (of 12,580 total)
Problem:
The customer wanted to display only posts with a custom image field in her view. However, when attempting to add a filter for this custom image field, it was not listed, nor were any other custom image fields.
Solution:
After further investigation, it was confirmed that the custom image fields not appearing in the filter section is expected behavior. We suggested using a wpv-conditional shortcode to test if the image exists as a workaround and provided a link to additional code that could help. Rita decided to rework the website to make images a required element when creating profiles.
The customer inquired whether it is possible to create content templates using Elementor.
Solution:
We confirmed that Toolset is compatible with Elementor and that it is indeed possible to create content templates using Elementor. We provided a tutorial link with a step-by-step guide, including screenshots, to assist the customer in setting it up.
The customer wanted to allow coaches, defined as CPTs, to edit their own records using Toolset Forms. He explored two potential methods but was unsure how to implement them using Toolset, especially since he uses the legacy version of Views. The primary challenge was to ensure each coach could only edit their own record without using the standard WordPress authentication system.
Solution:
We suggested using a unique URL with a secret parameter to allow coaches to access and edit their records. The steps include:
Adding a custom field (coach_secret) to each coach's profile.
Generating and sending a unique URL to each coach containing the secret parameter.
Creating a custom shortcode to handle the secret verification and display the form pre-filled with the coach's details.
Implementing a custom function to validate the secret parameter against the coach_secret field.
Here is a simplified version of the custom code used:
Problem:
The customer needed to filter posts in her directory by a custom taxonomy called Features, ensuring that only posts with all selected tags were displayed (using an AND operator instead of OR).
Solution:
We determined that Toolset Blocks does not natively support changing the operator from OR to AND for multiple select fields. As a workaround, we enabled legacy views and configured the custom search to use the AND operator. Additionally, we used custom code with the wpv_filter_query filter to change the operator to AND. The specific code was added to the theme's functions.php file, targeting the correct view_id:
add_filter('wpv_filter_query', 'custom_taxonomy_query_operator', 10, 3);
function custom_taxonomy_query_operator($query_args, $view_settings, $view_id) {
if ($view_id == 509) {
if (isset($query_args['tax_query'])) {
foreach ($query_args['tax_query'] as &$tax_query) {
if (isset($tax_query['operator']) && $tax_query['operator'] == 'IN') {
$tax_query['operator'] = 'AND';
}
}
}
}
return $query_args;
}
Problem:
The customer wants to target and apply different code to specific items in a View loop, specifically targeting items 1-6 with one code and items 7 and beyond with a different code (including adding a data attribute for lazy load).
Solution:
We suggested using the [wpv-loop-index] shortcode along with the [wpv-conditional] shortcode to conditionally apply code to items based on their index within the View loop. The provided example shows how to use these shortcodes to target items with an index less than or equal to 6 with one code and items with an index greater than 6 with another code that includes the lazy load attribute.
For example:
[wpv-layout-start]
[wpv-items-found]
<!-- Target items with index less than or equal to 6 -->
[wpv-conditional if="( '[wpv-loop-index]' le '6')"]
<div class="item">
<!-- Your code for items 1-6 -->
</div>
[/wpv-conditional]
<!-- Target items with index greater than 6 -->
[wpv-conditional if="( '[wpv-loop-index]' gt '6')"]
<div class="item" data-lazy="true">
<!-- Your code for items with lazy load attribute -->
</div>
[/wpv-conditional]
[wpv-no-items-found]
<p>No items found</p>
[/wpv-items-found]
[wpv-layout-end]
The customer reports that the "Added to Cart" message is not displaying correctly on their product page, even though a previous similar issue had been resolved. The initial troubleshooting step of toggling the AJAX add to cart buttons did not resolve the issue.
Solution:
I identified that the issue was caused by a specific line of code in the template that interfered with the wpv-add-to-cart-message shortcode:
The content on the blog archive page is not fully translated. A slider added to the archive template appears correctly in the default language (Spanish), but in other languages (e.g., English), a different slider from another plugin is shown. The archive pages sometimes show French as the default language instead of Spanish, indicating a potential conflict between WPML and Toolset.
Solution:
The customer discovered that the plugin "Post Types Order" by Nsp Code was causing the issue. This plugin created different template versions for each language and changed the default language of existing templates.
Deactivating and reactivating plugins one by one helped identify the culprit.
The customer removed the "Post Types Order" plugin, which resolved the issue.
The customer wants to display a custom field (Distributer) on a custom post page, but the field only shows "Booktopia/Amazon" regardless of the actual content, even if the field is blank. Other custom fields are working correctly.
Solution:
I identified that the issue was with the Content Template where the value 'Booktopia/Amazon' was added as plain text instead of a dynamic field.
I replaced the static text with the correct shortcode [types field='distributor'][/types] to dynamically display the field's content.
After the change, the proper distributor value is being displayed correctly on the custom post pages.
The customer wants to insert a search form created with Toolset into the homepage of their site built with Divi. They have followed documentation for Gutenberg, but it is not applicable for Divi without losing their work. Additionally, they want to display search results in multiple columns instead of a single large column.
Solution:
To insert the search form into the Divi homepage, use the "wpv-view" shortcode:
[wpv-form-view name="View 1" target_id="123"]
Replace '123' with the ID of the page where search results should appear. Use the following shortcode on the results page:
[wpv-view name="View 1" view_display="layout"]
In the Divi editor, use a text or shortcode widget to place these shortcodes.
Problem:
The customer is using the WPML plugin to translate their website and encountering two major issues:
1- Images are not being displayed on some pages.
2- URLs are automatically adding a "." at the end, leading to 404 errors.
Solution:
1- URL Issue:
I identified and removed the extra character causing the URL issue by editing the view translation.
This resolved the broken links.
2- Image Display Issue:
The issue was caused by malformed HTML, specifically the custom HTML used to insert left and right arrow buttons in the sliders.
The Advanced Translation Editor was encoding the HTML tags, breaking the display.
Two possible workarounds were suggested: using actual Toolset components or registering the arrows as shortcodes.
I implemented the second workaround with the help of our 2nd tier support:
- Added a shortcode to functions.php to register the custom widget:
- Registered the glide_arrows shortcode in Toolset settings.
- Edited the template containing the sliders and replaced the div with the arrow buttons with the [glide_arrows] shortcode.
This resolved the issue with the images.
Problem:
The customer wants to add shapes to a map rendered by Toolset. They have geoCoordinates and wish to use the Google Maps addJSON feature but encounter difficulties because the map is already rendered by the time they can access it with JavaScript.
Solution:
I recommended using the js_event_wpv_addon_maps_init_map_completed event listener to run scripts when the map is rendered. An example was provided to adapt for adding a background color to a map area after rendering.
Upon trying the provided code, the customer encountered errors in the JS console and the shapes did not render as expected. Further investigation and temporary site access were requested to diagnose and resolve the issue. However, the customer was able to move forward with the original reference and resolved their issue.
Problem:
The customer reported that updating filter values triggers the fade effect, but the posts remain unchanged. This issue occurs on their articles and ebooks pages. Solution:
To troubleshoot, we requested temporary admin login details and permission to create a staging version of the site for debugging. After initial investigations and involving our 2nd tier support, we created a new view for the Articles post type with an Ajax-enabled category filter. This view worked as expected without the customizations. We replicated this setup on the production site, creating an alternative view (Alt Articles) and recommended that the customer gradually apply their customizations to identify the step causing the issue.