Urls in Custom Post Type work for Terms but not for its Taxonomies

[taxonomy_name] should be available in permalink automatically if you register it as register_taxonomy(‘kalendar’, [taxonomy_name], $args ); So Try this foreach($this->months as $month => $month_var) : $args = array( ‘labels’ => array(‘name’ => $month), ‘hierarchical’ => true, ‘rewrite’ => array( ‘slug’ => $month_var ), ‘query_var’ => true ); register_taxonomy($month_var, ‘kalendar’, $args); endforeach; Then Save Permalink Settings … Read more

Filter By Category Dropdown List With Custom Taxonomies

Just from skimming your code, it actually pretty much does the same as the WordPress API function wp_dropdown_categories(). It isn’t as sophisticated though, no insult intended. Because wp_dropdown_categories() is capable of displaying deeper leveled hierarchies – correctly – then your own function, I can’t see a reason for not just using wp_dropdown_categories() for your purpose. … Read more

How do I make multiple dependent input fields that use the jquery autocomplete function?

Add a autocomplete ‘select’ catch to your first autocomplete field. Use this to get the chosen value from the autocomplete. Use an Ajax call to obtain your next autocomplete source based on the selected value and apply the new source to the next autocomplete field. jQuery( “#cns-make” ).autocomplete({ source: availableTags, select: function (event, ui) { … Read more

Get template part with CPT and Custom Taxonomy conditionals

Your order of your if/else statement is wrong. You would want to have your complex condition (or most important condition) at the top and the simplest (or least important condition) at the bottom. if/else statements work on the basis that the first condition that hits true will be executed. In your example above, if you … Read more

Create a a form for custom taxonomy terms

at the simplest level, you could put the options in a select list which would allow a user to ctrl + click to select multiple terms for your form submission. (For something fancier, use javascript/jquery/etc) You can then write a return function that uses wp_query to filter on the terms (you didn’t specify if you … Read more

Hide custom taxonomy from easy admin

Sounds like just setting show_ui to false will do what you’re after – it will hide the taxonomy in the admin menu, and it won’t create a metabox on the post edit page. After this: ‘hierarchical’ => true, Add this: ‘show_ui’ => false, You’ll find a full reference of all the available arguments over at … Read more

How to get CPT category checkbox list and show post of selected(multiply) checkboxes via ajax?

Try adding return false; to prevent the default submit action of the click. $(‘.grp_getnew’).on(‘click’, function(){ var data = { action: ‘get_random_post_tu’, usecategory: $(‘#categoryselect’).val() }; $.post( ajax_object.ajax_url, data, function(response) { if ( response.status != ‘error’ ) { var $link = $(“<a href=”” + response.link + “”>” + response.title + “</a><span >” + response.content +”</span>”); $(‘.grp_content’).html($link); } … Read more

How add body_class from wp_termmeta

First check it is product category archive page using is_tax Then use get queried object_id to get the current term ID Then after you can use get_term_meta to get class name. Example: add_filter( ‘body_class’, ‘lalka_custom_taxonomy_in_body_class’ ); function lalka_custom_taxonomy_in_body_class( $classes ){ if (is_tax(‘product_cat’)) { $custom_class = !empty( get_queried_object_id() ) ? get_term_meta(get_queried_object_id(), ‘custom-class’, true) : FALSE; if … Read more