Returns an array of category objects matching the query parameters. Arguments are pretty much the same as wp_list_categories and can be passed as either array or in query syntax.

learn more… | top users | synonyms

0
votes
0answers
34 views

How to sort category by custom field value

I am using the following : $catargs = array( 'meta_key'=> 'category_custom_order', 'orderby' => 'meta_value_num', 'order'=> 'ASC', ); but I can get the ...
0
votes
1answer
12 views

Show all child categories associated to post ID within loop

I'm looping through all posts and I'm trying to output the category nicename related to each post. So if there are categories A,B and C with post X only associated with categories A and C then I only ...
0
votes
2answers
21 views

How to display category list with category description

I have five categories for a custom post type, additionally I have installed a plugin to enable upload image to each category detail, actually I can get show list of categories with details. I need to ...
-1
votes
0answers
24 views

get_category($ID) is returning null

I have the following code: $ID = get_the_id(); echo $ID; $cat = get_category($ID); var_dump($cat); The id is echoed correctly but $cat is logged as NULL. I've also tried: $cat = get_category($ID, ...
2
votes
0answers
36 views

How to show subcategories in categories else show posts

I have hierarchy like this: Category1 -Subcategory1 -Subcategory2 --Post1 Category2 -Subcategory1 I need to show subcategories name and description when i go to category//// Now i use this code: ...
0
votes
1answer
19 views

get_categories returns top-level categories instead of child categories

I've made a basic subcategory nav menu using the code below. The problem is on one category (with NO children), it returns the Top Level categories as children, e.g.: News, Uncategorized, etc. (I've ...
0
votes
0answers
66 views

show/display/print list of sub-categories (of a specific parent category) assigned to products that have a specific other category

I have to find the products assigned to a specific category and after,just about those products, show the list of sub-categories of a specific parent-category here's a example scheme: product 1 - ...
0
votes
2answers
31 views

Limiting number of related posts

I'm trying to add a related posts section to the bottom of my single post views. It needs to grab the categories of the current post and show just 2 posts that match any of those categories. I'm ...
0
votes
2answers
60 views

Using ACF custom field for custom post type to order categories

I'm trying to use this answer to order categories based on their Advanced Custom Fields custom field: track_order. I'm able to get the UL to print fine and show the custom field numbers but I'm ...
0
votes
2answers
44 views

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, ...
1
vote
2answers
105 views

Exclude category by slug for for each loop

I am trying to exclude some categories from a for-loop. <?php $categories = get_categories(array('exclude' => 'apps, windows')); ?> <?php foreach ($categories as $category) : ?> ...
0
votes
2answers
317 views

Display sub categories of a parent product in products - woocommerce [closed]

I have searched this forum for the possible solutions but I am not getting anything which works. Maybe I am doing it the wrong way. Here is the code that I have tried so far $parent_categories = '' ...
0
votes
1answer
76 views

Get archives as array

I'm looking for a way to get the values returned from wp_get_archives as an array, similar to get_categories. I need to do this to modify the post counters to use - [#] instead of (#). See my current ...
0
votes
2answers
97 views

list all categories that have a certain word in title

How to list all the categories that have a certain word in title - first word of the category? in category.php so, for example, if I am viewing the category "Green Apples Sells", it will list all the ...
0
votes
0answers
37 views

Categories in the wrong order php

I have this code of php and it pulls categories in the wrong order <?php $args = array( 'hide_empty' => false, ...
0
votes
0answers
10 views

Get latter category child of a parent category

guys! I need to get the last child of a category within a loop : category -category son --categoria last child
0
votes
1answer
23 views

Get images by category

My current way of getting the images for sliders is by using the following code that works perfectly: $args = array( 'post_type' => 'attachment', 'sort_order' => 'ASC', ...
0
votes
1answer
59 views

Getting the first parent of a hierarchical term

How get avô this hierarqui category: avô -mae --filho It always give me the last child : <?php $product_cats = wp_get_post_terms( get_the_ID(), 'product_cat' ); $single_cat = ...
0
votes
1answer
101 views

Get current_parent_category in a loop or Cat ancestor- big problem

Im having some trouble since a week now . .. I'm having a bad time with that ! I explain my situation: I have setup a style for post category. (a background-color and a small image background). ...
0
votes
1answer
64 views

get parent_category class in loop

I'm trying to have the parent_category class in my loop. I've tried this: <a href="#" class="<?php $parent = get_category($cat); echo $parent->category_nicename;?>"> <?php ...
-1
votes
1answer
155 views

loop mix my child-category and parent-category

i explain the situatio I'm having: I have a blog, which on the homepage, have display the most recent post. For each post category, I have set up one specific color and icon by css. ex: for ...
0
votes
1answer
82 views

WordPress - List Sub Categories and Sub-Sub Categories, With Posts

I have the following code. It allows me to show sub categories and documents within them. The thing is, a sub category may contain further sub categories. The code below will show documents belonging ...
0
votes
1answer
62 views

Only list category if it has a custom field image

i've a problem showin a list categories. $args = array( 'orderby' => 'name', 'order' => 'ASC' ); $categories = get_categories($args); foreach($categories as ...
0
votes
0answers
64 views

How To Get WordPress Categories Last Update Date?

I am trying to make a custom sitemap for my WordPress blogs categories. For that I added the below code in my functions.php file and save it. Now all things is working fine but I want to get the date ...
0
votes
1answer
107 views

Display 2nd category, only once, as sub-heading, in the loop

I have a Custom Post Type ("Rental"). I am using the code from this article I found to display Rental custom posts on a page, with the Categories of a custom Taxonomy ("Region") as headings between ...
1
vote
1answer
51 views

How To Get WordPress Categories Link List?

I am trying to make a custom sitemap for my WordPress blogs categories. For that I added the below code in my functions.php file and when I save it, my Blog goes white. Nothing is showing up. I ...
0
votes
1answer
202 views

Function/Class to list categories with checkboxes

I want a list like in the pictue; witch is here - Posts->New->Select Categories At the moment i have this echo '<select name="pn-cats[]" size="8" style="width: 100%" multiple>'; $args = ...
0
votes
0answers
46 views

get_categories that have 12 extra fields

I add extra fields for all category. like this :- //add extra fields to category edit form hook add_action ( 'edit_category_form_fields', 'extra_category_fields'); //add extra fields to category edit ...
0
votes
1answer
113 views

How to select single category in menu if post have two categories?

My website's post have one, two, three etc categories depends on articles. My menu is made of categories. when i select post (open whole article) it shows post category in menu. Problem : when i ...
1
vote
1answer
830 views

how to get value of wp_dropdown_categories

I am making a widget and I have used the wp_dropdown_categories() function in that widget. What I can't figure out is how to get the selected value from the dropdown. What variable is the selected ...
0
votes
2answers
59 views

Undefined property: stdClass::$id when retriving term ID

I have the following: foreach( $this_post_terms as $term ) : $thiscat = get_term_by( 'slug', $term->slug, 'categories_whatever' ); echo $thiscat->ID; endforeach; The last line throws an ...
0
votes
1answer
168 views

Category with description and thumbnail

I am using the below codes to show all Parent Terms from a custom taxonomy with title and link on a page. But I want to show the parent term description, thumbnail and post count in it too. So how I ...
0
votes
1answer
57 views

Display the category name of a post that is in two different categories

I'm trying to get the category of a post that is in 2 different category. One category is always "Featured" and the other changes. I can only see the word Array() This is my code: <?php $args = ...
0
votes
2answers
81 views

Category specific order

I am trying to figure out how to display the categories in a specific order. Let's say my category IDs are in the following order: 1,3,4,2,5 I want to display the categories in that sequence. Here is ...
0
votes
0answers
30 views

Get custom type category from a category posts

I've been searching the way to do it but no good. The title may be confusing, let me explain my problem... I have the archive page (the main category), then I've posts inside that category and inside ...
1
vote
1answer
618 views

Get subcategories with JSON API plugin

How to get subcategories with JSON API wordpress plugin? I see how to get categories, but what is the way to get categories with subcategories at the same time? How should I modify the existing code? ...
1
vote
3answers
767 views

get only sub category ID

i need to get only sub category ID. i already get sub category id but it coming with main category id too bellow is code <?php while ( have_posts() ) : the_post(); ?> <option ...
0
votes
1answer
270 views

get_terms from registered taxonomies not working

In functions.php I can var_dump() taxonomies like: $taxonomies=get_taxonomies('','names'); echo '<pre>'; var_dump($taxonomies); which give me: array(7) { ["category"]=> string(8) ...
0
votes
1answer
900 views

Display Categories or Subcategories with name & description in category.php

I have the following issue for my customer. Can some suggest a possible solution to this issue? This website has Categories & Subcategories Cat1 -Subcat1 -Subcat2 -Subcat3 Cat2 -Subcat1 ...
0
votes
2answers
188 views

If posts category is “cars”, display image

Can someone translate this: If posts category is "cars" show image For example: I have an article with category 'car' and another article with category 'banana'. No I'm looking for a way to add an ...
1
vote
2answers
357 views

User Defined order on get_categories?

Below is some basic code to call specficic categories to our front page post loop. It works fine, except my client wants the categories displayed in a particular order. I know there are other posts ...
1
vote
1answer
50 views

Proper syntax or method for keeping url in modified isotope / category links

I'm setting up a project gallery using isotope jquery plugin for layout and filterability. I've seen examples of how to add a list of category links and modify them to filter on click, but... I want ...
0
votes
0answers
60 views

Related sub category posts with thumbanils

I want to show sub sub category posts and title Like Parent Cat Sub Cat Sub Sub Cat <--- I use the following code but shows me all posts from Parent cat , sub cat and sub sub cat posts. ...
2
votes
1answer
93 views

Get the category is not working on url

Although this is my first post but i have been coming here for answers so I know the rule and this isn't a duplicate because i have tried whatever i could but couldn't seem to get my codes to work. ...
0
votes
0answers
24 views

Paginate Term Archive? [duplicate]

I have a custom template displaying an "archive" of terms. When a term is clicked it takes the user to a list of all the posts assigned that term. I am not using a traditional loop to achieve my term ...
0
votes
2answers
48 views

Show all sub categories?

Is it possible to show all child/sub categories of all parent cats? I have the following hierarchy: Parent Cat/Tax -- Sub 1 -- Sub 2 Parent Cat/Tax 2 -- Sub 1 -- Sub 2 I would like to be able to ...
1
vote
1answer
705 views

display taxonomy slug from term ID

I'm trying to display the taxonomy slug from the term ID, thus my current code is like so: <?php $catinfo = get_category(array_pop(get_sub_field('sector_selector'))); ?> <?php print ...
0
votes
0answers
24 views

How to Create Category Template list Subcategory?

im have database category -Category 1 --S1 Category 1 --S1 S1 Category 1 --S2 S1 Category 1 --S2 Category 1 -Category 2 --S1 Category 2 -Category 3 How to create check in Category as: Is go to ...
-2
votes
1answer
937 views

woocommerce display product category on checkout page [closed]

I am trying to get product category on check out page for showing a special message for shipping for specific category. For this I have created action filter on woocommerce_available_shipping_methods ...
1
vote
2answers
488 views

How to get all unique categories for posts in loop?

I'm looking to get a plain list of the unique categories in a custom loop (only categories for the posts in the loop). I've been fumbling with some code for a bit and here's what I've got: <?php ...