exclude category from WordPress Form function

What about using the exclude array key in your get_categories() call? e.g. change this: $massive_categories_obj = get_categories(‘hide_empty=0’); to this: $massive_categories_obj = get_categories(‘hide_empty=0&exclude=14’); Note that exclude expects a comma-separated string as a value. For your second function, what are you passing as $exclude? function retrieve_cat_data_sp( $exclude ){ $args = array( ‘hide_empty’ => ‘0’, ‘exclude’ => $exclude … Read more

Custom category template pagination problem

Well, modifying this codilight_lite_custom_paginate() function is not a good option. Cause if it gets modified then it might cause problem on other pages. So if you want to paginate your archive.php child category foreach loop then remove the codilight_lite_custom_paginate() function and customize your archive.php page like below – <?php /** * Category Template: Custom */ … Read more

Is it possible to put next and previous category links?

Not sure if this is what you want, gets all the categories and outputs a link to the next and previous in the order returned from get_categories(): $this_category = get_queried_object(); $categories = get_categories(); foreach( $categories as $position => $cat ) : if( $this_category->term_id == $cat->term_id ) : $next_cat = $position + 1; $prev_cat = $position … Read more

How to have Multiple Archives Widgets, one archive widget per category (in a different page)?

I finally found an answer using WordPress rewrites. The whole code is at the end and can be pasted in functions.php. There is just one parameter that you have to change $rules = cpt_generate_date_archives(‘news’, $wp_rewrite); news is the name of the post_type. So I added a second line to show how to have two archives. … Read more

How to Check if a Child Category is Being Queried

The function cat_is_ancestor_of takes two arguments (two category IDs). To check if category of ID 61 is ancestor of category with 54: cat_is_ancestor_of(54,61); I’m not sure if there is a better way of doing this, but you can get the current category’s ID with the get_queried_object() and then check this an ancestor of the category … Read more

Show Subcategory Description

wp_list_categories formats the results, instead you want to try get_categories and create your own loop to format the results. I do not know exactly how you want it formated, but this gives you the general idea. <?php if (is_category()) { $this_category = get_category($cat); if (get_category_children($this_category->cat_ID) != “”) { echo “<div id=”catlist”><ul>’; $childcategories = get_categories(array( ‘orderyby’ … Read more