Views is a WordPress plugin that lets you easily customize the standard WordPress listing pages using WordPress archives. You can redesign any WordPress archive, including custom post archives, taxonomy archives, author archives and search results.
When you ask for help or report issues, make sure to tell us what you have created so far and what you want to achieve.
Viewing 15 topics - 1,021 through 1,035 (of 1,399 total)
Problem:
I display my Custom Fields with the Toolset ShortCodes for it.
But some Fields have no value yet, still they try to be shown on the front end (as an empty paragraph, obviously)
What can I do to avoid this?
Solution:
You need to wrap your Fields into conditionals to check if they exist.
Problem:
Client has added content at the top of a custom taxonomy archive which should appear on page, even when a term has no posts assigned.
Solution:
The content needs to be added in the Loop Output section *before* the items found block. Content added to the items found block will only appear if matching posts are returned.
[wpv-layout-start]
<!-- content added here will always appear -->
[wpv-items-found]
<!-- content added here will appear once if at least one matching post is returned -->
<!-- wpv-loop-start -->
<wpv-loop>
<!-- content added here is repeated for every post found -->
</wpv-loop>
<!-- wpv-loop-end -->
Problem:
Is it possible to force alphabetic sort, regardless of whether an item is a parent or a child (via some function)? Like: B always comes after A and before C, no matter which one is a parent.
Solution:
Right now Views use the same logic as WP has for parent/child terms, I have submitted a request to our development team to improve it if possible. This might be possible using JS but I am not certain how.
This type of JS code or modifications falls into Custom coding & custom development and it is out of support policy (https://toolset.com/toolset-support-policy/). So we recommend to contact Toolset recommended service providers to further discuss the custom approach. We have some recommended list of service providers here if you would like to take a look: https://toolset.com/consultant/
Problem: I would like to show "Filed under: News" instead of "Filed under: Posts" on my custom search results archive page.
Solution: Use a conditional statement to test the post type of the current post in the loop, and display different text depending on the results of that test.
Problem: Using PHP, I would like to know if the current page is a custom post type archive, and I would like to be able to determine the name of the Content Template applied to the current page.
Solution:
Use the native WordPress function is_post_type_archive() to determine if the current page is a post type archive:
if ( is_post_type_archive( 'my-custom-post-type-slug' ) ) {
// do something
}
Use the wpv_filter_content_template_output filter to determine the assigned Content Template, and assign that value to a global variable. Then access the title of the Content Template post using get_the_title() since Content Templates are technically posts:
add_filter( 'wpv_filter_content_template_output', 'get_content_template_id', 99, 4 );
function get_content_template_id( $content, $template_selected, $id, $kind ) {
global $current_archive_template_id;
$current_archive_template_id = $template_selected; // $template_selected = current Content Template ID
return $content;
}
// later...
$content_template_title = get_the_title($current_archive_template_id);