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
35 views

Link (by categories) to the first and last posts in custom post type

Link (by categories) to the first and last posts in custom post type For a new theme, I created a “story” custom post type. The main content has a different style than the blogging part, with ...
0
votes
1answer
22 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
36 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
23 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
104 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
2answers
94 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
29 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
183 views

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

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
52 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
82 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
27 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
27 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
55 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
23 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
33 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
81 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
12 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
238 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
96 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
109 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
50 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
54 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
46 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
218 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
84 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
56 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 ...
0
votes
1answer
104 views

Saving category as insert post

I'm having a problem with $_POST a category. I got something like that : // ADD THE FORM INPUT TO $new_post ARRAY $new_post = array( 'post_title' => $title, 'post_content' => ...
0
votes
2answers
144 views

Difference between get_category, get_term_by and get_categories

get_category is returning null but using get term_by or get_categories() is not. Why? I have created term called categorycourses. I have a post related to coursecategory Lidköping (vardump1), ...
0
votes
1answer
28 views

Show category with link

I am trying to show the category of posts with link to its page, so I used this code but I don't know What's wrong with it. It is only showing the category without link. <p ...
0
votes
1answer
93 views

Trying to hide subcategories which have categories without posts

On custom archive pages, I want to show subcategories that don't have their own posts but have sub-subcategories that do have posts. And if a child category does not have posts, I want to hide its ...
1
vote
2answers
293 views

Showing current subcategory

I have problem. <?php query_posts('category_name=events&posts_per_page=2&offset=1'); ?> <?php while (have_posts()) : the_post(); ?> <div> <?php $children = ...
0
votes
1answer
109 views

Get last post in category thumbnail

I want make a button to filter posts from a specific category, But also i would like this button to display the featured image of the latest post in that category. I'm completly new to php and ...
0
votes
2answers
181 views

List posts by their custom taxonomy term, with a condition

I have two custom taxonomies called "custom-category" and "file_type". I am using the below code to list all the terms of "file_type" along with their associated posts. Like so: File_Type Term 1 ...
1
vote
2answers
289 views

Highlight current category, when using get_categories

I'm successfully using helgatheviking's answer from this post: Show children of top level category only See code below: // get the category object for the current category $thisCat = get_category( ...
0
votes
1answer
95 views

Search in particular category in wordpress

I am currently using the JSON API to get the data from wordpress http://wordpress.org/plugins/json-api/other_notes/ The plugin helps to retrieve the wordpress post data in JSON format I notice that ...
0
votes
1answer
84 views

Get a list of categories ids

I'm working on a portfolio with filters based on custom post type. That filters must display only categories for the posts that are displayed in the portfolio, since user can specify them by id in the ...
1
vote
1answer
199 views

Trying to sort and display categories(not posts) by custom field: 'order'

I'm a WordPress rookie. I've added a custom field to my "Category" taxonomy. The custom field is "custom_order" and its purpose is to hold a number so that my categories can be sorted and displayed in ...
0
votes
0answers
87 views

How to display only the posts with category that match the current page URL

I'm trying to get the loop below to display only the posts with the name that matches the current page's absolute name. E.G: if the URL of the current page is mysite.com/current, then the post to be ...
1
vote
0answers
22 views

Show category name and new articles and display page numbers. What function to use

Show category name and new articles and display page numbers. What function to use. Ex. cat name 1 -listcat1 1 update -listcat1 2 update -listcat1 3 update -listcat1 4 update cat name 2 ...
0
votes
0answers
27 views

Secondary loop cuts off at 10 posts?

I have a loop to get a tag name from the URL slug, and then show all the posts, grouped by category, that matched that tag. It works, but I recently noticed it only shows 10 posts despite my setting ...
0
votes
1answer
235 views

Get categories list with category name in custom WP_List_Table class

Im building a plugin and i made custom wp_list_table class to suit my needs and display items with native wordpress look. The problem is that i can't get to list categories with categories names. I ...
0
votes
3answers
102 views

How to show more than 5 posts?

I am running code that shows child categories, and all posts in the child categories. But if there are more than 5 posts in a category, only the 5 newest are shown. How can I show all, or at least ...
1
vote
4answers
2k views

Display Image for a category using get_categories, or show an image from any child post

I am using get_categories to list the child categories of a parent category. I want to add an image to the child categories, using the get_categories output. I can either take the featured image ...
0
votes
1answer
47 views

Custom taxonomy list in Worpdress

I just registered following code in my function add_action( 'init', 'create_resources_taxonomies', 0 ); function create_resources_taxonomies() { $labels = array( 'name' ...
0
votes
2answers
141 views

How to display a list of categories

I'm trying to set up a list of categories with clickable links to that category. I've looked at: Display list of Sub-Categories and the posts they contain, within one main Category and am not ...
0
votes
1answer
60 views

Getting parent category hierarchy as objects from category template

What is the best way to get the hierarchy of parent category objects from the category.php template, when there is no post as such. The function get_category_parents() returns a string not the ...
0
votes
1answer
3k views

Display current category title on category page

Using the following code in a category template, but instead of showing the current category page that I am on, it displays the first category of the first post. For example on Food category page it ...
3
votes
2answers
3k views

How To Get Parent Category Slug of Current Post

My theme has styling by category using the following code, which inserts the current category's slug as a CSS class. <div class="CategorySpecificStyle <?php $category = get_the_category(); ...
0
votes
1answer
123 views

How to Highlight current category on category and single page template?

On Wp Forums, I found a code that shows categories with images and it works very well. But I couldn't figure out how to highlight current category on category.php and single.php Here is the code that ...
2
votes
1answer
211 views

get custom post type categories

From http://codex.wordpress.com: $categories = get_categories( $args ); $args = array( 'type' => 'post', 'child_of' => 0, 'parent' => ...