Types is a WordPress plugin that lets you quickly create custom post types, taxonomies and fields in your website through the WordPress admin screen instead of adding PHP code to your theme. Types User Guides include detailed documentation for setting up your custom content.
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 through 15 (of 13,073 total)
Problem:
The customer wants to set a custom field as the featured image for an entire custom post type. They are looking for a solution to establish this custom field globally for each post, as they did not find an existing feature in the documentation that meets this requirement.
Solution:
We informed the customer that there is no built-in feature within Toolset to directly set a custom field as the featured image. However, we provided a workaround involving the following steps:
Use the save_post action hook to trigger a PHP function when a post is saved.
Use the get_post_meta function to retrieve the custom image field value.
Retrieve the remote image file using cURL.
Save the image into the WordPress media library using wp_insert_attachment.
Set the media ID as the post's featured image using set_post_thumbnail.
Additionally, we shared a link to a forum post where a colleague provided a working example of code that runs through all posts of a specific custom post type, assigning a given custom field as the featured image.
The customer wants to create a primary sort based on a custom field and a secondary sort based on the title (alphabetical). Despite trying various changes, the primary sort seems to override the secondary sort. The customer is unsure if the issue is related to caching or another problem.
Solution:
I initially suggested using the wpv_filter_query to modify the orderby parameter in the theme's functions.php file. This involved adding the following code, replacing '1234' with the post view's ID and 'custom-field' with the custom field slug:
The customer reported that the secondary sort was still not working. After further investigation and testing with a staging site, I identified that the issue was specific to the CPT Products.
I provided a workaround that involved modifying the orderby filter to include secondary sorting by title. The following code was added to the theme's functions.php file:
<?php
function func_orderby_title($orderby) {
global $WP_Views;
if ($WP_Views->current_view == 14670) {
$orderby = $orderby . ", wp_posts.post_title ASC";
}
return $orderby;
}
add_filter('posts_orderby', 'func_orderby_title');
?>
I tested the solution on the staging site and then replicated it on the live site, confirming that the sorting issue was resolved.
The customer wants to sort results based on the comments count.
Solution:
Upon further review, I identified that the comment_count field in the wp_posts table can be used directly for sorting. I provided a code snippet to add to the theme's functions.php file to sort by the comment_count field:
Problem:
The customer wants to have a different WooCommerce product archive template for each of their two categories. However, when attempting to add a filter to apply it to a category, they receive an error indicating that the filter cannot be applied.
Solution:
Taxonomy term filters are not supported on taxonomy archives, and the error received is expected behavior. For example, if on a taxonomy WordPress archive page (e.g., "my-tax"), the filter will not work on that page and will display a warning message.
As a workaround, the customer can create a view to display term archive page links:
Create a taxonomy view that lists terms of the custom taxonomy.
Display the term's archive page link with the shortcode [wpv-taxonomy-link].
Insert this taxonomy view into the taxonomy WordPress archive.
This allows users to click the links and be redirected to the corresponding term's archive page.
Problem:
The customer is trying to update Toolset Types from version 2.2.23 to 3.5.2 after purchasing a license, but they encounter an error message.
Solution:
If the website has very old versions of Toolset plugins, such as Types version 2, automatic updates won't work due to the significant version difference. A manual update is required:
Download the plugin from the Toolset account downloads page.
Upload the newer version of Types to the site via the WordPress admin area:
Navigate to WP Admin -> Plugins -> Add New Plugin -> Upload Plugin.
Confirm to overwrite the existing plugin version when prompted.
Once updated manually, future updates for Toolset plugins should be manageable from the admin area.
Problem:
The customer reported that their Toolset plugin throws a fatal error and mentioned a suggestion to reinstall a fresh copy of the plugin. Despite reinstalling, the issue persists with version 3.1.3, preventing them from providing debug info. Solution:
We recommended manually replacing and updating the plugins. The steps included making a backup, disabling and removing all Toolset plugins, downloading fresh versions of Toolset plugins (Types v3.5.2, Blocks v1.6.15), and then installing and activating them. When the initial solution didn't resolve the issue, we requested temporary access to the site to further investigate and manually install the plugins. After this intervention, the fatal error was not experienced during our tests.