Articles of wp list categories

Latest updated categories list query, exclude one from displaying

I have this query: $cat_array = array(); $args=array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘exclude’ => ‘187’, ‘posts_per_page’ => 19, ‘caller_get_posts’=> 1 ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); $cat_args=array(‘orderby’ => ‘none’); $cats = wp_get_post_terms( $post->ID , ‘category’, $cat_args); foreach($cats as $cat) { $cat_array[$cat->term_id] = $cat->term_id; […]

get_terms() parent, child and grandchild

parent1 – child1 – grandchild1 I need to show child terms of any current term (only direct child) for each term I visit. Works only for the parent (show child1) but not for the child (doesn’t show granchild1) How I can fix this issue? Thank’s $queried_object = get_queried_object(); $cpt = get_post_type( get_the_ID() ); $taxonomy = […]

wp_list_categories not excluing multiple ids

I recently updated to WP 4.4 and im using this code: $args = array( ‘orderby’ => ‘ID’, ‘show_count’ => 1, ‘taxonomy’ => ‘portfolio-type’, ‘use_desc_for_title’ => 1, ‘echo’ => 0, ‘title_li’ => ”, ‘exclude’ => ‘115,161’ ); wp_list_categories($args); it’s only excluding the first id 115, and ignoring other IDS, any solution for this?

Difference between wp_list_categories and get_categories

Whats the difference between the wp_list_categories and get_categories? WordPress codex says use get_categories if needs a function that does not format the results what format is this referring to? Will it affect the performance if I use the other one? And if i want to display all the hierarchical custom taxonomy links on a page, […]

wp_list_categories() by alphabet? (ex. only category titles that start with “A”)

I have used this code function show_categories_fn(){ return wp_list_categories(“echo=0&title_li”); } add_shortcode(‘show_categories’, ‘show_categories_fn’); I got the category list but I need alphabetic letters shown here below: A Apple Arkansas B Bangkok Borat Bunghole C Cat Copper

How to show Sub Categories on Categories page?

I have a product page which is assigned as category.php. Now i want to show Sub Categories as Sub Menu on the Category page. But even after searching alot i couldn’t show all sub categories yet. I found one code which is : <?php if (is_category()) { $this_category = get_category($cat); } ?> <?php if($this_category->category_parent) $this_category […]

Trying To Get Child Categories To Show, Issue With foreach Loop

I made 6 sub-categories, all children of my “Resources” category, and I’m trying get them to display on a page, but at the moment it’s only displaying the first category (leading me to believe my error is in the foreach loop). My PHP: $categoryslug = get_category_by_slug( ‘resources’ ); $categories = wp_list_categories( ‘title_li=0&child_of=’ . $categoryslug->term_id ); […]

With wp_list_category put every existing category into an option tag

Like the title says, I’m using wp_list_categories to get all of the existing categories of my website listed. I would like to achieve this: <select class=”filters-select”> <option value=”.category1″>category1</option> <option value=”.category2″>category2</option> <option value=”.category3″>category3</option> … </select> I’m not sure how the code has to be to achieve that structure, so far I have this which it’s not […]

Not showing list if there aren't any categories to display

maybe you can help: Bellow there is a simple code listing my blogs categories. I need some code that will not display the *ul is there aren’t any categories to display* <ul> <li><p>Categories:</p></li> <? $master_cat = get_category_by_slug(‘Master’); $master_cat_id = $master_cat->term_id; $slave_cat = get_category_by_slug(‘Slave’); $slave_cat_id = $slave_cat->term_id; wp_list_categories(‘orderby=name&title_li=&exclude=’.$master_cat_id.’,’.$slave_cat_id.”); ?> </ul> Ty very much

How can I make wp_list_categories output li with category-slug as class, for its children?

Simply put, I’d like to change the wp_list_categories output from this: <li class=”cat-item cat-item-1″><a href=”http://mysite.com/category/articles”>Articles</a></li> <li class=”cat-item cat-item-7″><a href=”http://mysite.com/category/design”>Design</a></li> to this instead: <li class=”cat-item category-articles”><a href=”http://mysite.com/category/articles”>Articles</a></li> <li class=”cat-item category-design”><a href=”http://mysite.com/category/design”>Design</a></li> So I tried Google and I’ve found a solution mentioned on this question add filter to wp_list_categories and query if used to list tax-terms? . […]