Get custom category name from ID

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

Make Custom Taxonomy Category Use Parent Template

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; }

How to output the taxonomy term name in a widget

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

Change in custom taxonomy permalink causes 404 error for another custom taxonomy

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

How to display posts from a single category within a custom taxonomy

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)