Tag Info

Hot answers tagged

2

You can make use of the hide_empty argument of get_terms(), it defaults to true. Do it somewhat like this: $args = array( 'hide_emty' => false ); $terms = get_terms( 'wpsc_product_category', $args );


1

To get direct descendants (i.e. children only) of the category, you need to make use of the parent parameter in get_categories() The reason why you might not see your other category is that it does not have any posts assigned to it. To display empty categories, you need to set the hide_empty parameter to 0 Otherwise I do not see any problems with your ...


1

I believe you are using the following code from this pastebin link function posts_by_year() { // array to use for results $years = array(); // get posts from WP $posts = get_posts(array( 'numberposts' => -1, 'orderby' => 'post_date', 'order' => 'ASC', 'post_type' => 'my-custom-post-type', 'post_status' => ...


1

You'll need to do at least two things (possibly more, I haven't thought it all the way through), in it's simplest form: Prevent category output lists from creating links: You'd need to emulate get_the_category_list() and build your own category list without anchors, or you could probably just filter out the <a> tags: add_filter( 'the_category', ...


1

add_filter('term_link', 'term_link_filter', 10, 3); function term_link_filter( $url, $term, $taxonomy ) { if ( is_category( 'news-article', $term ) ) { wp_safe_redirect( 'http://mysite.com/news', 301 ); exit; } return $url; } This should work.



Only top voted, non community-wiki answers of a minimum length are eligible