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

-5
votes
0answers
14 views

add_filter( 'post_thumbnail_html') vs wp_get_post_categories($posts[0]->ID) [on hold]

Hi there I have a problem bacause of: function my_post_image_html( $html, $post_id, $post_image_id ) { $sowot = wp_get_post_categories($posts[0]->ID); $large_image_url = ...
0
votes
0answers
16 views

Get array of parent and other child categories based on one child

I'm trying to modify a custom wp_query that's generating related posts. Currently, it's returning other posts in the same category, which is a sub-category. I'd like it to ALSO return posts from the ...
-2
votes
1answer
40 views

How to get if category has posts?

I have problem with getting get_category('2')->category_count number. I want to have list of news which are as a post in one category. I use plugin for insert php (I know it can be used by theme). ...
0
votes
0answers
13 views

Need help understanding get_the_category function parent-child order?

I am unable to understand how WP fills up the array which get_the_category function returns. This is the hierarchy of categories in two cases: Cat 1 > Cat 2 > Cat 3 Cat 1 > Cat 2 In the first case,...
-1
votes
0answers
22 views

how to get the child categories of products in the spicial style

I work on themes i get and can't know how to redesign the component to get what i need so i get the HTML of the element i need from the Pagebuilder in the theme and i make some search and find this ...
0
votes
0answers
20 views

how do i add an array of objects or an extra field to a wordpress json api core controller?

Is there a way to add an array of objects to a core controller of the json api plugin the core controller i want to modify is 'get_category_index' and it returns these objects id post_count name ...
0
votes
1answer
17 views

Store All Post Categories In Array

I'm trying to collect a list of all categories used on posts. However, the following code only returns the first category. How could this be adapted to collect all categories, if the post has ...
0
votes
1answer
22 views

How can I ask to an existing category?

I want to echo the child category name. That works. But how can I ask after an existing category, so that I have no <h6>-tag when I have no category? Where is my mistake? <?php $...
0
votes
1answer
16 views

Parent and child relation code and display only first child list

for Indoor -for bedroom --TFL ---8u ---9u --MFL ---10u ---11u -for Kitchen --ABC ---4u ---5u --XYZ ---6u ---7u These are the category listing... when user click on the for bedroom at that time show ...
0
votes
0answers
57 views

Proper way of listing posts from custom archive with sub-categories

I am trying to create a register of things, using custom post type, named register, and custom taxonomy named register_cat. It will have categories and sub categories, something like this: Cat A ...
1
vote
0answers
31 views

Get image from parent category

I am creating a page which shows all post categories and image associated with the categories. Each category has a textbox for the user to paste an image's URL and the page will then display the ...
2
votes
0answers
22 views

get / list categories and counts filtered by custom taxonomy term

In my post 'post type' besides "categories" I've a custom taxonomy called "product-types". The category is actually more "manufactures" of the product types. I've a product-types page where I list ...
1
vote
1answer
52 views

Detect whether a page is a product subcategory page?

How can I detect whether current page is a product sub category page? I've tried with the following but it will always print out "NO" function is_subcategory($category = null) { if (is_category()...
3
votes
1answer
296 views

Listing a post's categories and subcategories

Is there a way to display the parent categories and subcategories for a particular post (ie. for use on single.php). I've tried using get_the_category_list(), but it displays a list like this: ...
0
votes
1answer
38 views

Loop categories by recent post

Im looking for a way to loop through categories and then display the recent posts for each one in a container but I need a way to sort the categories by which ones have the most recent posts So if ...
0
votes
0answers
34 views

Show name of post category, and name of category parrent (if category has parent)

Example: I have category named "Food" and inside that category another category named "Fruit". How to show name of post category, and its parent category (it category has parent category). After ...
1
vote
1answer
40 views

Custom category order with get_categories

I have a site with metro_creativex theme with side menu that displays categories in an alphabetic order. Now I need to sort them by my own order (that's not alphabetical reverse or by id) and, since ...
0
votes
1answer
137 views

How to display get_categories selected category?

I'm creating a widget, and I'm displaying categories list in form function: echo '<select name="categories">'; // Add custom option as default echo '<option>' . __('No Category', '...
0
votes
1answer
197 views

Add inline style to get_the_category_list

I need to style the get_the_category_list() a tag but can't seem to find a way. This is my code: echo '<ul class="list-inline meta-list">'; // Get the categories $terms = get_the_terms(...
1
vote
1answer
233 views

How to get category image custom post type taxonomy in wordpress?

I have a custom post estate_property and its has taxonomies property_category ,propert_action.I have installed WPCustom Category Image to upload image for each category of taxonomies. How to display ...
1
vote
1answer
33 views

Get categories with posts by custom field value

I have a big categories tree (~2000 total subcategories)... And I have a lot of posts with custom field "city" (different values). I have created filter posts by "city" field. But I have problem with ...
1
vote
0answers
26 views

How to show custom taxonomy in the permalink?

I used the Portfolio Post Type Plugin to create custom tax and post type. I would like to show the custom taxonomy on the portfolio projects. portfolio/customtaxonomy/project while now is ...
0
votes
2answers
71 views

Get Category Archive Template Name Dynamically

I'm making a category archive template that works for all my categories. I need to dynamically set the 'category' parameter of WP_Query inside of this template to make it work. How do I dynamically ...
3
votes
1answer
150 views

How to list all categories and tags in a page?

Suppose we have few categories, tags and custom post type and taxonomies. How can we list all categories, tags in a page? Something like; Page Category Thumbnail and Category Name 1(link to ...
0
votes
2answers
54 views

How to display taxonomy terms the way they are hierarchical

Reading Kaiser's query and Scribu's answer I'm now in an ocean of no shore. I made a custom taxonomy, where I want to show the terms as per their hierarchy, like below: Level 0 -- Level 1 --- Level 2 ...
0
votes
1answer
44 views

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 ...
0
votes
0answers
34 views

Getting posts for a category

I have a menu made up of categories, click a category shows the users list of articles beloging to said category. However I seem to have stumbled across a problem if a post belongs to 2 or more ...
0
votes
1answer
77 views

List posts of assigned categories in list of all categories on single.php

here's what I'm trying to accomplish: I've got several categories, each of them have several posts. Now, on category.php I'm able to output a list of all categories and, inside this list, show a list ...
0
votes
1answer
68 views

Group child category IDs based on their parent category

I have IDs for my child categories, 11,14,21,35,38,39, where these all are various child categories from their main category: Parent category 1 has: 11,14 Parent category 2 has: 21 Parent category 3 ...
0
votes
1answer
247 views

using checked function to verify value against an array

I have a 2-level taxonomy terms checkbox list (created with get_categories) that stores values into the usermeta table. I'd like to display the checked items when the page is refreshed. This is the ...
0
votes
0answers
24 views

Order get_categories() by the order they show up in the backend

I am using Woocommerce and have 1800 products that are in 18 different categories. The idea is to have a page display these 18 different categories as links to their archives. The problem is I want ...
0
votes
1answer
356 views

Get the child category ID of current category

I am trying to get the category ID of the child (no grand children) of the current category. Using below method: $category = get_category(get_query_var( 'cat' )); // get category ID $catid = $...
2
votes
1answer
159 views

Category Archive, list subcategories of each post

I found this post, but it was never answered. I'm looking for the same thing, haven't been able to find a solution so far. My problem is that I can't find a way to list subcategories unique to each ...
0
votes
1answer
108 views

How to get category link without a database query

I use Wordpress 4.3.1 with PremiumPress Business Directory Theme. The theme's homepage renders a list of categories using code that's basically: $args = array( 'taxonomy' => THEME_TAXONOMY,...
0
votes
0answers
232 views

How to add a Load More button for get_categories()?

I want to add an Ajax "Load More" button for category post display. I want to show only 6 categories per page. However, the other categories are loading after clicking on the button. Can anyone help ...
0
votes
0answers
22 views

View list of categories from values ​​in custom fields

Through the Advanced Custom Fields created a field to add values ​​in each category. example: Category A = Cars Category B = Aircraft Category D = Boats Category E = Aircraft Category F = Boats ...
0
votes
0answers
58 views

easy digital download , dropdown category

i want to show download category as a dropdown button for each category , and sub category list base on category. i searched , and use my knowledge , result: <?php function my_list_edd_terms() { ...
0
votes
1answer
2k views

woocommerce - how to get product link by id

i have 2 product_cat Product cat 1 id : 6 Product cat 2 id : 8 in my index how to get product cat link with id or slug as: <a href="Product cat 1 (link)">Product cat 1(name)</a> <a ...
0
votes
1answer
445 views

WP Dropdown Categories, display subcategories but not grandchildren categories?

So my main goal is to create 3 drop-down category options to run a search. It's for a car website, so I have 3 parents, "Make", "Model", and "Year" At the moment I have the following code <?php $...
0
votes
2answers
315 views

Get categories query not working in function.php

I am trying to get the categories of my custom post type in functions.php But it not return any value, when i run this query in any theme file it work fine. Here is my code function get_destinations()...
0
votes
1answer
493 views

Get child categories of custom taxonomy category?

I am using custom post type : portfolio and have taxonomy for that portfolio_category. I need to get sub categories for a particular category using the above custom taxonomy. In short, How can I get ...
0
votes
1answer
30 views

showing tag beside catagory

thanks for your guidance, here is one last but not least thing for me to learn, i am using Today news wordpress theme, since with your help i have moved my process from category to tag based ...
0
votes
1answer
569 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
110 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 ...
-1
votes
2answers
243 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 ...
4
votes
2answers
226 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
59 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
2answers
56 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
349 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
118 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, '...