Skip Navigation

[Resolved] Taxonomy data not populating in parametric search field, only custom post types

This support ticket is created 8 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Author
Posts
#369972
taxonomy.png
fields.png

We are creating a parametric search using the view API and are having troubles populating taxonomy in the a select tag. There will be 3 select menus that help filter the search, these being: country, state, and personnel program.

Any idease how to get them to show up properly, here is the code:

[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="form-horizontal">
  <div class="form-group">
    <label for="wpv-category" class="col-sm-3 control-label">[wpml-string context="wpv-views"]First Name:[/wpml-string]</label>
    <div class="col-sm-9">
    	[wpv-control field="firstname" url_param="firstname" type="textfield" class="form-control"]
    </div>
  </div>
  <div class="form-group">
    <label for="wpv_post_search" class="col-sm-3 control-label">[wpml-string context="wpv-views"]Last Name:[/wpml-string]</label>
    <div class="col-sm-9">
      [wpv-control field="lastname" url_param="lastname" class="form-control"] 
    </div>
  </div>
 
  <div class="form-group">
    <label for="wpv-category" class="col-sm-3 control-label">[wpml-string context="wpv-views"]Company:[/wpml-string]</label>
    <div class="col-sm-9">
    	 [wpv-control field="companyname" url_param="companyname" class="form-control"]
    </div>
  </div>
  
  <div class="form-group">
    <label for="wpv-category" class="col-sm-3 control-label">[wpml-string context="wpv-views"]Certification Number:[/wpml-string]</label>
    <div class="col-sm-9">
    	 [wpv-control field="certificationnumber" url_param="certificationnumber" class="form-control"]
    </div>
  </div>
  
   <div class="form-group">
    <label for="wpv-category" class="col-sm-3 control-label">[wpml-string context="wpv-views"]Qualified Personel Programs:[/wpml-string]</label>
    <div class="col-sm-9">
    	  [wpv-control taxonomy="qualified-personel-program" url_param="wpv-qualified-personel-program" type="select" default_label="ALL" taxonomy_order="ASC" taxonomy_orderby="name" hide_empty="false" class="form-control"]
   
    </div>
  </div>
  
  <div class="form-group">
    <label for="wpv-category" class="col-sm-3 control-label">[wpml-string context="wpv-views"]Country:[/wpml-string]</label>
    <div class="col-sm-9">
    	   [wpv-control taxonomy="qualified-personel-country" url_param="wpv-qualified-personel-country" type="select" default_label="ALL" hide_empty="false" class="form-control"]
   
    </div>
  </div>
  
  <div class="form-group">
    <label for="wpv-category" class="col-sm-3 control-label">[wpml-string context="wpv-views"]States:[/wpml-string]</label>
    <div class="col-sm-9">
    	    [wpv-control taxonomy="qualified-personel-state" url_param="wpv-qualified-personel-state" type="select" taxonomy_orderby="id" default_label="ALL" hide_empty="false" class="form-control"]

   
    </div>
  </div> 
                                 
  <div class="form-group">
    <div class="col-sm-offset-3 col-sm-9">
		[wpv-filter-submit name="Submit" class="btn btn-primary" type="button"]
		[wpv-filter-reset reset_label="Reset" class="btn btn-danger" type="button"]
		[wpv-filter-spinner container="div" position="before" spinner="<em><u>hidden link</u></em>"][/wpv-filter-spinner]
    
    </div>
 </div>
</div>
<hr />
[/wpv-filter-controls]
[wpv-filter-end]
#370052

Thank you for contacting us here in the Support Forum and for providing the Debug Informations

Could you please elaborate a little more on this point
❝are having troubles populating taxonomy in the a select tag. ❞
so I can better understand?

Sometimes screenshots illustrating what you mean may go a long way to clarify what words fail to transmit, so if you like, make use of "upload an image" below the comment area.

You also use outdated Toolset Plugins, which does not mean, that things should not work.

Please see here how you can create Taxonomies with Types Plugin:
https://toolset.com/documentation/user-guides/create-custom-taxonomies/

And here how to use them in a Parametric Search created with Views:
https://toolset.com/documentation/user-guides/front-page-filters/
https://toolset.com/documentation/user-guides/filtering-views-by-taxonomy/
https://toolset.com/documentation/user-guides/filtering-posts-by-user-selected-taxonomy/

Please could you provide me the additional Infos?

Thank you for your patience.

#370305

Hi Support,

I am trying to recreate this People search page in wordpress using the views APi:

hidden link

Everything thing is working except for : Country, Province/State, Certification Program which are taxonomy. We have over 4000 people posts on out site, so we are using this search API as a way to filter.

Post type is:
Qualified Person - (First name + Last Name) - assigned to taxonomy and custom fields group

Selected Taxonomies for Qualified Person :
Qualified Personel Countries
Qualified Personel States
Qualified Personel Programs

Custom Fields Group: Qualified Person
First Name - Single line field
Last Name - Single line field
Company Name - Single line field
Certification Number - Single line field

So basically everything that is under the Custom Fields Group is working as intended as a text field search. However, not for anything that is under the selected taxonomy group. We want all the Countries, States, and Programs to be searchable by drop down menu.

Any solution?

#370520

Can I see this on your Backend?

With Views you can easily create "DropDowns" (Select) Parametric Searches for Taxonomies assigned to Posts.
You seem to already have done it.

There is currently a BUG that could bother you, please see this:
https://toolset.com/errata/taxonomy-filter-on-a-parametric-search-is-not-displaying-any-options/

Also if you use Custom fields with Checkboxes in a Parametric Search, please consider this Fix:
https://toolset.com/errata/filtering-by-multiple-checkboxes-fields-fails-to-return-results/

Additionally if you paginate results with AJAX, please see this Fix:
https://toolset.com/errata/nested-views-and-ajax-pagination/
https://toolset.com/errata/views-ajax-pagination-fails-to-load-pages/

Currently we have too many issues with Views Results - they all will be solved in a future version, and currently you can apply the above fixes. Please also check that Errata Page for eventual other issues:
https://toolset.com/errata/

If this does not solve your issue, I would eventually also need to request temporary access (WP-Admin and FTP) to your site
- preferably to a test site where the problem has been replicated if possible -
in order to be of better help and check if some configurations might need to be changed

Your next answer will be private which means only you and I have access to it.

❌ Please backup your database and website ❌

✙ I would, if possible, need access to a site where only a minimal set of Plugins and a default theme is active.
This to avoid eventual compatibility issues with other software.

✙ Please add the Links to:

- The Views Edit Screen

- The Page/Post where you insert the View

- The corresponding Front End Page/Screen

Please don't hesitate to inform me in case the issue persists

Thank you for your patience.

#371552

Swapping out the files did the trick and now the categories are showing up in the drop down for views.

The problem we are still having is that some of the pages are coded using php and we can not get the taxonomies to load up in the dropdowns there.

In the example below, only the option "--ALL--" is showing up. Any ideas?

Code:

<select name="search_productcategory" id="search_productcategory" class="form-control">
<?php
$args = array(
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => false,
'hierarchical' => true,
);

$terms = get_terms('recall-Category-name', $args);
?>
<option value=""><?php _e( '-- ALL --', THEMETD ); ?></option>
<?php
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
foreach ( $terms as $term ) {
echo '<option value="' . $term->slug . '">' . $term->name . '</option>';
}
}
?>
</select>

#371695

Glad to hear that it now works.
As the original issue is resolved may I kindly ask you please to open a new ticket for your additional question?
This will help other users with similar problems to find solutions when searching the forum.
If this is OK with you, we would handle issue #1 in this Thread
❝Taxonomy data not populating in parametric search field, only custom post types❞

The Code you are using is a Custom PHP Query which we do not support in this Forum, as this can be done with Toolset from within the Guided user Interface.

You can as example create a Drop Down menu with a Taxonomy View, where you link each item in the menu to a page, where a View sits which displays Posts by taxonomy passed in a URL parameter.

I elaborated on this some time ago here:
https://toolset.com/forums/topic/cannot-figure-out-how-to-make-taxonomy-term-archive-pages-with-parametric-search/#post-364596

If you need custom programming work, which is beyond the scope of our support, I would suggest you consider contacting one of our certified partners from this link:
https://toolset.com/consultant/

You will get the custom assistance you need to get on with your project.

Most probably the Query does not return the correct values.
You could remove your conditional to check this, or try to print out $term to see what is returned.

Please do not hesitate to open a new thread if other issues or problems arise

Thank you for your patience.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.