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
2answers
18 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
28 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
29 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
55 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
98 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
45 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
74 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
25 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
6 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
17 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
45 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
63 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
50 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
137 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
58 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
47 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
57 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
86 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
46 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
140 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
38 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
106 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
556 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
49 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
135 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
51 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
68 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
475 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
637 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
188 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
758 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
134 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
308 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
48 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
55 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
92 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
44 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
590 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
22 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
812 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 ...
0
votes
2answers
389 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 ...
1
vote
1answer
501 views

Show only first children level of current category?

I wish to display only first level of subcategories on current category page (if any). I tried this code: <?php $args=array( 'child_of' => $cat-id, ...
0
votes
0answers
81 views

Get parent category name and content

How can I get my parent category info in my category page. Let me explain details. Say like I have a category like Photos Gallery One Gallery Two Gallery Three I used feature category ...
0
votes
1answer
92 views

How to check if a post is in categories x,y,z inludint their subcategories

I am trying to check whether a post is in categories X, Y, Z (including the subcategories within them). This is the piece of code I have tried in my single.php: if ( in_category(array( '1', '2', ...
0
votes
1answer
79 views

Widget dropdown always displays first option

I have a custom widget that I have made but whenever I change the dropdown value it always reverts to the first option when I save the widget. How can I have it display whatever option the user ...
0
votes
2answers
964 views

Loop through categories and create tab for each

I'm trying to create a page that holds all categories of my custom post type as tabs, with a tab content. I am able to display all the category names as tabs, but i need to run a query in each tab ...
0
votes
3answers
464 views

How to select posts from one category but exclude posts in another category?

I am trying to select posts that have category id 4 but exclude posts that also have category id 2 Here's what i'm trying $query = new WP_Query(array( "cat__in" => array(4), ...
0
votes
0answers
90 views

How to use get_categories results called in header.php on the homepage as well without calling the database twice?

I have a Wordpress blog with multiple categories and I have to display the last two posts of certain categories(not all of them) in the header. This is so as to have this information available ...