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
19 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
43 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
15 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
18 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
37 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
22 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
25 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
16 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
7 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
52 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
56 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
54 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
41 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
40 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
33 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
1answer
66 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
61 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
42 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
59 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
85 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
25 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
56 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
165 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
80 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
78 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
128 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
85 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
72 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
123 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
68 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
26 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
186 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
87 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
40 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' ...
1
vote
2answers
88 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
48 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
1k 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 ...
2
votes
2answers
2k 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
89 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
132 views

get custom post type categories

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

Wordpress get_categories & listing recent post thumbnail

I'm trying to get a page to list all the child categories and then display their name and a thumbnail from the most recent post in that category. This is the following code I've got, it appears to be ...
0
votes
1answer
63 views

Show parent categories of the current category

this code returns the parent categories of the current category with links separated by '»': echo get_category_parents( $cat, true, ' » ' ); will output: Internet » Blogging » ...
1
vote
1answer
49 views

Getting category before saving post

I am using the filter "wp_insert_post_data" to decide what to save to the database. I need to know which category has been picked before saving the post. How can I get to know the category that has ...
-1
votes
1answer
350 views

Get only the top level categories using get_categories() without foreach loop

Very simple Question: Here is my get_categories() code: <?php $args = array( 'show_option_all' => '', 'show_option_none' => '', ...
0
votes
2answers
3k views

Get current category id from post page wordpress

I have a problem to get category id of current post. We are using <?php get_the_category( $id ) ?> for finding out category of current post. If a post like 'demo' has 2 category like cat1 and ...
0
votes
3answers
75 views

Any kind of custom post type in the front page and in the archive listing

I have a custom post type:products to have my post from my custom post type i have changeed these codes <?php $post_count = 1; ?> <?php if (have_posts()) : while ( have_posts() ) : ...
0
votes
0answers
259 views

Custom fields setup when category selected filter subcategories

Hi all I have custom taxonomies and custom user input fields for submiting their classifieds. So what I was intending to do is: users should select category, I want to make it able when user select a ...
0
votes
1answer
465 views

Get terms for a specfic post from multiple taxonomies in custom post type

I have created Custom post type 'references' and two taxonomies under this e.g "Custom Taxonomy A" have Categories "Cat-a1" , "Cat-a2".... "Custom Taxonomy B" have Categories "Cat-b1" , ...