Create Admin Only Taxonomies?
I believe when registering the taxonomy: setting public to false and show_in_menu, show_in_nav_menus, show_ui all to true would solve what I THINK is your request, without knowing any further what your use case is.
I believe when registering the taxonomy: setting public to false and show_in_menu, show_in_nav_menus, show_ui all to true would solve what I THINK is your request, without knowing any further what your use case is.
See the inline comments. Not tested. The following code will grab all the Custom Taxonomy Terms of Custom Taxonomy ‘product-cat’ and will show them one by one from the result array. <?php global $post; $postID = $post->ID //get/put your post ID here $getProductCat = get_the_terms( $postID, ‘product-cat’ ); //as it’s returning an array foreach ( … Read more
Hook into template_include filter add_filter(‘template_include’, ‘research_term_template’); function research_term_template( $template ) { if ( is_tax(‘classifications’) ) { $parent = get_term_by(‘slug’, ‘oldresearch’, ‘classifications’); // to improve performance you can hardcoding ‘oldresearch’ term id // $parent = 12; if ( term_is_ancestor_of( $parent, get_queried_object(), ‘classifications’ ) ) return get_template_directory() . ‘/taxonomy-Classifications-oldresearch.php’; } return $template; }
@Maor Barazany – Glad you joined this site. I think adding a custom field to your taxonomy witch is in the form of select tag so each one of your taxonomy terms is linked to a category is the best way to create that relationships. Then on your meta box create a dropdown of you … Read more
Fix : Custom Taxonomy Duplicating in each call
You could achieve this with a little bit of jQuery: Create this file within THEMEFOLDER/js/ called field-clear.js and replace #formID with the ID of the form you would like to reset: //Code runs when an ajax request succeeds jQuery( document ).ajaxSuccess(function( event, xhr, settings ) { //Check ajax action of request that succeeded if(settings.action == … Read more
As it turns out, though terms could not be edited without affecting all instances, they could be deleted without deleting all instances. So, it looks as though the answer is this: you cannot separately edit a term that’s in multiple taxonomies, but you can remove that term from a taxonomy without removing it from the … Read more
Check the properties of get_queried_object(). Sample code: <?php # -*- coding: utf-8 -*- /** * Plugin Name: Current Term Widget */ add_action( ‘widgets_init’, array ( ‘Current_Term_Widget’, ‘register’ ) ); class Current_Term_Widget extends WP_Widget { public function __construct() { parent::__construct( ‘current_term’, ‘Current Term’ ); } public function widget( $args, $instance ) { if ( isset ( … Read more
After many efforts I have solved it, but it’s not completely what I want, as I had to compromise on one thing and passed some separators in the URL. Example: example.com/separator1/parentatx/childtax/separator2/postname/ In order to avoid 404 errors, in case of pagination and another custom taxonomy, I created some rewrite rules. Here is my code: First … Read more
I believe your looking for something like this <?php $args = array( ‘posts_per_page’ => 1, ‘post_type’ => ‘inventory’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘inventory-category’, ‘field’ => ‘slug’, ‘terms’ => array( ‘bulk-racks’ ) ) ) ); query_posts( $args ); while ( have_posts() ): the_post(); // do stuff here ?> <?php endwhile; ?> Heres how to … Read more