Getting Catategory / Taxonomy Description on Non-archive Pages

Can you pull in the description of a custom tax on pages other than the taxonomy-(custom-tax).php i.e on the home page you want to show the description of a custom tax. This works on the aforementioned archive page but nowhere else: <?php echo term_description( ”, get_query_var( ‘taxonomy’ ) ); ?> Many thanks for any help. … Read more

custom sort posts in archive/taxanomy page

I want to override the default sort order of posts in archive and taxonomy pages. what hooks should I implement? Answer Put something along these lines in your functions.php: add_filter( ‘pre_get_posts’, ‘custom_get_posts’ ); function custom_get_posts( $query ) { if( is_category() || is_archive() ) { $query->query_vars[‘orderby’] = ‘name’; $query->query_vars[‘order’] = ‘ASC’; } return $query; } reference … Read more

Hide empty categories from get_categories

I’m trying to hide the empty categories (with no posts associated) from a list in an archive page. I’m using hide_empty as suggested on WordPress codex but it’s not working, the code outputs all categories: <ul class=”filter-menu”> <?php $cat = get_query_var(‘cat’); foreach(get_categories(‘parent=0&hide_empty=1’) as $category) { echo ‘<li><a href=”#” data-filter=”.’. $category->slug.'” >’ . $category->name.'</a></li>’; } ?> … Read more

query only direct child and sub-terms of a current term archive

i’m using woocommerce on my theme, and it comes with a proudct_cat term as a defualt catagory on the shop proudct. I need to show on every proudct_cat archive its direct child and the sub-tems, but not the sub terms child. I tried: <?php $thispage = $wp_query->post; wp_list_categories(“taxonomy=product_cat&term=”. $term->slug.”&title_li=&child_of=”.$thispage->slug);?> and it returned all proudct_cat as … Read more

WordPress 3.6 – archive.php doesn’t get triggered [closed]

Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for WordPress Development Stack Exchange. Closed 8 years ago. Improve this question I made a custom theme and just created an archive.php file. When I try to access http://localhost/wordpress/?m=201308 for example it just … Read more