Home › Toolset Professional Support › [Resolved] Content not showing
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
Tagged: Content Templates, Views, Views plugin
Related documentation:
This topic contains 24 replies, has 3 voices.
Last updated by rainman 6 years, 3 months ago.
Assisted by: Shane.
We have a legal Case archive page that is supposed to show cases for an Attorney (specified by URL query string). The cases are organized by the Practice Area and further by their Status. In the screenshot, you can see that this is a page this Attorney has the query string ?l=485 and it is for the appellate Practice Area. But there are no Cases listed. Here is the live page showing the blank output.
hidden link
I've included a second screenshot showing the Case that should be displayed and you can see that is assigned to an Status, Practice Area and Attorney.
Last, I have included a screenshot of the archive template so you can see the settings and code.
All the other cases are working, as you can see by browsing to a different Notable Cases page, and it seems like this one should be working too. I am stumped.
Hello,
Thank you for contacting our support forum.
Would you mid providing me with admin access so that I can have a look at this for you ?
Thanks,
Shane
Hello,
Unfortunately it seems the issue is with the
[if-check-count view_name="cases-count-for-case-status" practicearea="[wpv-post-taxonomy-practice-area]" l="[wpv-post-slug-by-l-param]"]
I'm unable to debug this since this is not one of our shortcodes and is a custom code.
Thanks,
Shane
Here are custom functions we have. This was originally setup for us by Ana Couto at Toolset. Maybe she could assist.
// get the post slug add_shortcode('wpv-post-slug', 'wpv_post_slug_shortcode'); function wpv_post_slug_shortcode($atts) { extract( shortcode_atts( array(), $atts ) ); $out = ''; if (!empty($_GET['l']) && is_numeric($_GET['l'])) { $out = get_post_field('post_name', $_GET['l'], 'raw'); } return $out; } // get the post slug directly from "l" URL param . This is useful when nesting shortcodes add_shortcode('wpv-post-slug-by-l-param', 'wpv_post_slug_by_l_param_shortcode'); function wpv_post_slug_by_l_param_shortcode($atts) { $out = ''; if (!empty($_GET['l']) && is_numeric($_GET['l'])) { $out = get_post_field('post_name', $_GET['l']); } return $out; } //workaround for wpv-if statement when evaluating views results add_shortcode( 'if-check-count', 'if_check_count_shortcode' ); function if_check_count_shortcode( $atts, $content = null ) { if ( ! empty ( $atts['view_name'] ) ) { $args = array( 'name' => $atts['view_name'] ); if ( ! empty ( $atts['current_post'] ) ) { $current_post = $atts['current_post']; $attorney_terms = get_the_terms( $atts['current_post'], 'attorney-tax' ); if ( is_array( $attorney_terms ) ) { foreach ( $attorney_terms as $attorney ) { $args['attorneytax'] = $attorney->slug; break; } } } else { $current_post = ''; } if ( ! empty ( $atts['practicearea'] ) ) { $args['practicearea'] = $atts['practicearea']; } if ( ! empty ( $atts['l'] ) ) { $args['l'] = $atts['l']; } add_filter( 'wpv_filter_' . str_replace( '-', '_', $atts['view_name'] ), 'wpv_filter_' . str_replace( '-', '_', $atts['view_name'] ) . '_func' ); $string = str_replace( array( "\n", "\r", "\t" ), '', render_view( $args ) ); remove_filter( 'wpv_filter_' . str_replace( '-', '_', $atts['view_name'] ), 'wpv_filter_' . str_replace( '-', '_', $atts['view_name'] ) . '_func' ); $result = preg_match( '/<div\sid="wpv-view-.*>(.*?)<\/div>/', $string, $match ); if ( $result && isset( $match[1] ) ) { sscanf( $match[1], '%d', $count ); if ( is_numeric( $count ) && 0 === $count ) { $content = ''; } } } return do_shortcode( $content ); } add_shortcode('if-check-taxonomy','if_check_taxonomy_shortcode'); function if_check_taxonomy_shortcode($atts, $content=null) { extract( shortcode_atts( array( 'view_name' => '', 'taxonomy' => '', ), $atts ) ); if ($view_name == 'practice-areas-tax') { $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); if (isset($term->slug) && $term->slug == $taxonomy) { } else { $content = ''; } } return do_shortcode($content); } add_shortcode('wpv-post-taxonomy-practice-area', 'wpv_post_taxonomy_practice_area_shortcode'); function wpv_post_taxonomy_practice_area_shortcode($atts) { $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); return $term->slug; } //filter hook to allow execution of view filter code function wpv_filter_cases_count_for_case_status_func($filter) { return true; } // filter properly the 'cases-count-for-case-status' view add_action('pre_get_posts', 'filter_cases_count_for_case_status'); function filter_cases_count_for_case_status($query) { if (!isset($query -> query_vars['post_type'])) $query -> query_vars['post_type'] = false; if (!is_admin() && is_array($query->query_vars['post_type']) && in_array('cases', $query->query_vars['post_type'])) { $taxonomies = array( 'attorney-tax'=>array('url_param'=>'l', 'type'=>'post_id'), 'practice-area'=>array('url_param'=>'practice-area', 'type'=>'slug') ); $enter_filter = apply_filters('wpv_filter_cases_count_for_case_status', false); if ($enter_filter) { $tax_query = $query->query_vars['tax_query']; $tax_query_values = array_key_values('taxonomy', $tax_query); foreach ($taxonomies as $taxonomy=>$settings) { if (!in_array($taxonomy, $tax_query_values)) { $terms = array(); switch ($settings['type']) { case 'post_id': if (isset($_GET[$settings['url_param']]) && is_numeric($_GET[$settings['url_param']])) { $post_name = get_post_field('post_name', $_GET[$settings['url_param']], 'raw'); if (!empty($post_name)) { $terms = get_term_by('slug', $post_name, $taxonomy); if ($terms) { $terms = array($terms->term_id); } } } break; case 'slug': $slug = ''; $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); if ($term->taxonomy == $taxonomy) { $slug = $term->slug; } if (!empty($slug)) { $terms = get_term_by('slug', $slug, $taxonomy); if ($terms) { $terms = array($terms->term_id); } } break; } if (!is_array($terms)) { $terms = array(); } $tax_query[] = array( 'taxonomy' => $taxonomy, 'field' => 'id', 'terms' => $terms, 'operator'=> 'IN' ); } } $query->set('tax_query', $tax_query); } } } // recursive get array values by key function array_key_values($needle, $haystack) { $output = array(); foreach($haystack as $key => $value){ if($key === $needle && !is_array($value)){ $output[] = $value; } else if (is_array($value)) { $output = array_merge($output, array_key_values($needle, $value)); } } return $output; } // dequeue wp-types front-end scripts and stylesheets add_action( 'wp_enqueue_scripts', 'prefix_remove_views_assets', 20 ); function prefix_remove_views_assets() { // Scripts // views_front_end_utils.js - used in Views parametric searches wp_deregister_script( 'wpv-front-end-utils' ); // wpv-pagination-embedded.js - used in Views pagination and table sorting wp_deregister_script( 'views-pagination-script' ); // jquery.ui.datepicker.min.js and wpv-date-front-end-control.js - used in Views parametric searches by a date field wp_deregister_script( 'jquery-ui-datepicker' ); wp_deregister_script( 'wpv-date-front-end-script' ); // Styles // wpv-views-sorting.css - used in Views table sorting wp_deregister_style( 'views-table-sorting-style' ); // wpv-pagination.css -used in Views pagination wp_deregister_style( 'views-pagination-style' ); } // NAKED VIEWS OUTPUT WITH NO WRAPPER DIVS add_filter( 'wpv_filter_wpv_view_shortcode_output', 'prefix_clean_view_output', 5, 2 ); function prefix_clean_view_output( $out, $id ) { if ( $id == '820' ) { //Please adjust to your Views ID $start = strpos( $out, '<!-- wpv-loop-start -->' ); if ( $start !== false && strrpos( $out, '<!-- wpv-loop-end -->', $start ) !== false ) { $start = $start + strlen( '<!-- wpv-loop-start -->' ); $out = substr( $out , $start ); $end = strrpos( $out, '<!-- wpv-loop-end -->' ); $out = substr( $out, 0, $end ); } } return $out; } add_shortcode('hide-it', function(){ return; });
Hello,
Thanks,
Could you let me know what was the last thing that was done when you started to notice this issue ?
Thanks,
Shane
There was no issue, then I entered a new Case and it doesn't display. That is all.
Hello,
Could you let me know which case this is ?
I'm trying to debug this one for you before contacting Ana about this.
Thanks,
Shane
It's the newest case pictured in the first screenshot
Hello,
I've contacted Ana for asssitance with this but she won't be available until next monday. Is this ok with you ?
Please let me know.
Thanks,
Shane
Yes, that is okay.
Any update???
Please let me know what is going on.
Hello,
Not sure why I wasn't getting an email on this ticket.
I haven't gotten a response from Ana regarding this as yet but I can try again to debug this for you again to see if I can come up with a reason for this not working.
Sorry for taking so long to respond as I wasn't getting the notification that you had responded.
Thanks,
Shane
I appreciate you giving it a shot, but I hope you will try again with Ana. She set it all up and if you look at my ticket history (all with this this same website) you will see that she is always the one who solves the problems. It is a very complicated setup with lots of related pieces. I am especially worried about making changes that fix this page, but cause something else to break that we don't know about until some time in the future when somebody happens to notice a problem. Sometimes the pages look okay at a glance and it isn't until you really look at it that you realize incorrect posts are displayed or the sort is wrong or ..... We have had it happen before.
Hello,
I've escalated this to our 2nd tier supporters so that they can look and provide some advise as well.
Thanks,
Shane