WordPress Archive for Products not Updating
Started by: benE-3
in: Toolset Professional Support
Quick solution available
Problem:
The user has an issue with an archive template for one specific product. A condition based on the product stock was not evaluating correctly.
Solution:
Changing the conditions from using variables to using shortcode fixed the issue.
Changing:
[wpv-conditional if="( $(views_woo_in_stock) eq '1' )"]In stock[/wpv-conditional][wpv-conditional if="( $(views_woo_in_stock) eq '0' )"]Out of stock[/wpv-conditional]
To:
[wpv-conditional if="( '[types field='views_woo_in_stock'][/types]' eq '1' )"]In stock[/wpv-conditional]
[wpv-conditional if="( '[types field='views_woo_in_stock'][/types]' eq '0' )"]Out of stock[/wpv-conditional]
2
3
4 years, 6 months ago
benE-3
Can you toolset_get_related_post(s) function to retrieve posts by user ID?
Started by: himanshuS
in: Toolset Professional Support
Quick solution available
Problem:
The user would like to programmatically get related posts that are created by the current user.
Solution:
That's not possible with the Toolset API. We need to, first, get the related posts, then we can use a wp_query to get the current user's posts within them. This is an example code:
$applications = toolset_get_related_posts($post->ID, 'job-to-job-application', 'child');
$posts = get_posts(array(
'author' => get_current_user_id(),
'post__in' => $applications
));
if( count( $posts ) > 0) {
echo 'View Application';
}
else {
echo 'Apply';
}
Relevant Documentation:
2
3
4 years, 6 months ago
himanshuS
custom search
Started by: eugeneB-4
in: Toolset Professional Support
Quick solution available
2
3
4 years, 6 months ago
eugeneB-4