Skip Navigation

[Resolved] Txonomy filters not displaying on all pages correctly

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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 7 replies, has 1 voice.

Last updated by charitosA 3 weeks, 6 days ago.

Assisted by: Minesh.

Author
Posts
#2790284

Tell us what you are trying to do?

I need all the taxonomy views of my team members to be as they are on the our-team page. We have the view in another 3 pages.

Is there any documentation that you are following?

Is there a similar example that we can see?

hidden link

in the about us and the greek translation the script and the proper hierarchy is not rendered.

What is the link to your site?
hidden link

#2790328

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

With the information you shared its not clear what exactly you want to achieve.

Can you please share brief description about your issue with screenshot or video and what eactly you want to fix and where with what view and on what page?

#2790686

Hi Minesh,

The teams section appears on 4 pages in total with a particular order of the taxonomies and preselected 'expert-doctors' on page load. This is the correct view with the correct order but missing description: hidden link & hidden link
On the Greek translation of the pages, the order is also not correct:
- missing preselected on load the 'expert doctors' and correct order also the description is not showing:
1. hidden link
2. hidden link
THIS IS THE SETUP:
The Search and Pagination:
[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="form-group">
[wpv-control-post-taxonomy taxonomy="top-position" type="radios" orderby="id" url_param="wpv-top-position"]
</div>
[wpv-filter-spinner spinner="/wp-content/plugins/toolset-blocks/embedded/res/img/ajax-loader4.svg" class="loader"][/wpv-filter-spinner]
[/wpv-filter-controls]
[wpv-filter-end]

CSS :
form[name="wpv-filter-49247"] .form-group input[name="wpv-top-position"],
form[name="wpv-filter-49247"] .form-group label {
display:none !important;
}
form[name="wpv-filter-49247"] .form-group label[for="top-position-fertility"],
form[name="wpv-filter-49247"] .form-group label[for="top-position-%ce%bc%ce%b7%cf%84%cf%81%cf%8c%cf%84%ce%b7%cf%84%ce%b1"] {
display: none !important;
}

form[name="wpv-filter-49247"] .form-group label[for="top-position-expert-doctors"],
form[name="wpv-filter-49247"] .form-group label[for="top-position-embryologists"],
form[name="wpv-filter-49247"] .form-group label[for="top-position-midwives"],
form[name="wpv-filter-49247"] .form-group label[for="top-position-nurses"],
form[name="wpv-filter-49247"] .form-group label[for="top-position-care-taker"],
form[name="wpv-filter-49247"] .form-group label[for="top-position-treatment"],
form[name="wpv-filter-49247"] .form-group label[for="top-position-administration"],
form[name="wpv-filter-49247"] .form-group label[for="top-position-accounting"],
form[name="wpv-filter-49247"] .form-group label[for="top-position-services"] {
display:block !important;
}
form[name="wpv-filter-49247"] .form-group label[for="top-position-%ce%b3%ce%b9%ce%b1%cf%84%cf%81%ce%bf%ce%af"],
form[name="wpv-filter-49247"] .form-group label[for="top-position-%ce%b5%ce%bc%ce%b2%cf%81%cf%85%ce%bf%ce%bb%cf%8c%ce%b3%ce%bf%ce%b9"],
form[name="wpv-filter-49247"] .form-group label[for="top-position-%ce%bc%ce%b1%ce%af%ce%b5%cf%82"],
form[name="wpv-filter-49247"] .form-group label[for="top-position-%ce%bd%ce%bf%cf%83%ce%bf%ce%ba%cf%8c%ce%bc%ce%b5%cf%82"],
form[name="wpv-filter-49247"] .form-group label[for="top-position-%cf%86%cf%81%ce%bf%ce%bd%cf%84%ce%b9%cf%83%cf%84%ce%ad%cf%82-%ce%b8%ce%b1%ce%bb%ce%ac%ce%bc%ce%bf%cf%85"],
form[name="wpv-filter-49247"] .form-group label[for="top-position-%ce%b8%ce%b5%cf%81%ce%b1%cf%80%ce%b5%ce%af%ce%b1"],
form[name="wpv-filter-49247"] .form-group label[for="top-position-%ce%b4%ce%b9%ce%bf%ce%af%ce%ba%ce%b7%cf%83%ce%b7"],
form[name="wpv-filter-49247"] .form-group label[for="top-position-%ce%bb%ce%bf%ce%b3%ce%b9%cf%83%cf%84%ce%ae%cf%81%ce%b9%ce%bf"],
form[name="wpv-filter-49247"] .form-group label[for="top-position-%cf%85%cf%80%ce%b7%cf%81%ce%b5%cf%83%ce%af%ce%b5%cf%82"] {
display:block !important;
}

ul.pagination {
display: flex;
text-align: center;
justify-content: center;
background: none;
margin: 0 auto;
}

form[name="wpv-filter-49247"] .form-group input[name="wpv-top-position"], form[name="wpv-filter-49247"] .form-group label {
color: #2a4652 !important;
}

JS:

jQuery(document).ready(function($){
var params = new window.URLSearchParams(window.location.search);
var myurl = new URL(window.location.href);

// console.log(myurl.searchParams.has('wpv-team-member-type'));
if(!myurl.searchParams.has('wpv-top-position')){
$('#top-position-expert-doctors').attr('checked', true).trigger('change');
}

});

jQuery(document).ready(function($){
var params = new window.URLSearchParams(window.location.search);
var myurl = new URL(window.location.href);

// console.log(myurl.searchParams.has('wpv-team-member-type'));
if(!myurl.searchParams.has('wpv-top-position')){
$('#top-position-%ce%b3%ce%b9%ce%b1%cf%84%cf%81%ce%bf%ce%af').attr('checked', true).trigger('change');
}

});

jQuery(document).ready(function($){

$("div.form-group label:contains('-')").each(function(){

var text = $(this).html();

text = text.replace("  -", "");
$(this).html(text);
});

});

jQuery( document ).on( 'js_event_wpv_parametric_search_form_updated', function( event, data ) {
/**
* data.view_unique_id (string) The View unique ID hash
* data.view_changed_form (object) The jQuery object for the View form after being updated
* data.view_changed_form_additional_forms_only (object) The jQuery object containing additional forms from other instances of the same View inserted using the [wpv-form-view] shortcode
* data.view_changed_form_additional_forms_full (object) The jQuery object containing additional forms from other instances of the same View inserted using the [wpv-view] shortcode
*/
jQuery("div.form-group label:contains('-')").each(function(){

var text = jQuery(this).html();

text = text.replace("  -", "");
jQuery(this).html(text);
});

});

The Loop:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<div class="row">
<!-- Display the selected taxonomy category -->
<div class="col-lg-3 form-group">
<div class="selected-term">
<h3> </h3>
<!-- Display the name of the selected taxonomy term -->
<h2 clsss="selected-top-position">[wpv-control-post-taxonomy taxonomy="top-position" url_param="wpv-top-position"][wpv-search-term param="wpv-top-position"]</h2>
<!-- <p clsss="selected-top-position-descr">
[wpv-search-term param="wpv-top-position" format="wpv-top-position-description"] <br>
[wpv-search-term param="wpv-top-position" term="description"] <br>
[wpv-search-term param="wpv-top-position" format="wpv-expert-doctor-description"] <br>
[wpv-search-term param="top-position-description" show="top-position-description"]

</p> -->
</div>
</div>
<!-- Posts associated with the selected taxonomy -->
<div class="col-lg-9 team">
<div class="row">
<wpv-loop>
<!-- Single post -->
<div class="col-lg-4 col-md-4 col-4 team">
[wpv-post-body view_template="loop-item-in-team-members"]
</div>
</wpv-loop>
</div>
</div>
</div>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

I will highly appreciate your help in solving this.

#2790688

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I see your previous ticket and I found that the taxonomy term description was empty:
- https://toolset.com/forums/topic/how-to-fileter-taxonomy-search-and-display-taxonomy-description/#post-2787098

What description exactly you want to display and from where?

Lets fix issues one by one.

As I understand on the following page:
- hidden link

When I click on any taxonomy term, for instance "Accounting" - you want to display the associated term description. When I edit the "Accounting" term I see there is a description field but its empty as you can see:
- hidden link

#2790751

We have descriptions for a few categories:

Embryologists - Pioneers in creating life.
Expert Doctors - Leaders in fertility care.
Midwives - Bringing life’s miracles to light.
Nurses - With you every step of the way.
I followed the documentation here: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-taxonomy-description
and I added it in 4 different approaches but non was displaying and I added hide comment for the moment:
<!-- <p clsss="selected-top-position-descr">
[wpv-search-term param="wpv-top-position" format="wpv-top-position-description"] <br>
[wpv-search-term param="wpv-top-position" term="description"] <br>
[wpv-search-term param="wpv-top-position" format="wpv-expert-doctor-description"] <br>
[wpv-search-term param="top-position-description" show="top-position-description"]
</p> -->

#2791038

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've added the following custom shortcode to "Custom Code" section offered by Toolset:
=> hidden link

add_shortcode( 'display_taxonomy_description', 'func_display_taxonomy_description');
function func_display_taxonomy_description($atts){
    $parameter = $atts['parameter'];
    $value = $atts['value'];
    $taxonomy = $atts['taxonomy'];
     
   if ( (!empty($parameter)) && (!empty($value)) && (!empty($taxonomy)) && (!empty($_GET[$parameter])) ) {
        $category = get_term_by('slug', $_GET[$parameter], $taxonomy, 'ARRAY_A');
 
        if($category) {
            switch ($value) {
                case 'title':
                    return $category['name'];
                    break;
                case 'description':
                    return $category['description'];
                    break;
            }
        }
    }
}

To your view, I've added the above shortcode as given under:
=> hidden link

[display_taxonomy_description parameter="wpv-top-position" value="description" taxonomy="top-position"]

Can you please confirm it's working as expected now.
=> hidden link

#2791262

Hello Minesh,

Thank you for adding this shortcode. Now the descriptions are visible in both languages.
The issue with the order on both languages and preselected 'expert-doctors' by default in Greek pages remains.
This is the updated function to the new view and how the categories order should be:

// filters for all team members by priority category
add_filter( 'wpv_filter_query', 'filter_include_cat_fn_49247', 1000 , 3 );

function filter_include_cat_fn_49247( $query_args, $view_settings ) {
if ( isset( $view_settings['view_id'] ) && $view_settings['view_id'] == 49247 ) {
if ( empty( $query_args['tax_query'] ) ) {
$query_args['tax_query'][0]['taxonomy'] = 'top-position';
$query_args['tax_query'][0]['field'] = 'slug';
$query_args['tax_query'][0]['terms'] = array( 'expert-doctors', 'embryologists', 'midwives', 'nurses', 'care-taker', 'treatment', 'administration', 'accounting', 'services' );
$query_args['tax_query'][0]['operator'] = 'IN';
$query_args['tax_query'][0]['include_children'] = '';
$query_args['tax_query']['relation'] = 'AND';
}
}
return $query_args;
}

However, at the moment, it is displaying wrong order in English: Expert Doctors, Embryologists, Accounting, Administration, Midwives, Nurses, Services, Care Taker, Treatment.

#2791271

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

That is different issue. I'll split the ticket with your new question. Here is the spit ticket.
=> https://toolset.com/forums/topic/split-txonomy-filters-not-displaying-on-all-pages-correctly-issue-with-term-order/

As per our support policy, we entertain only one question per ticket. This will help other users searching on the forum as well as help us to write correct problem resolution summery.

You're welcome to mark resolve this ticket.

#2791273

I apologise and thank you. I am looking forward to resolving the new ticket.