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
26 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
0answers
22 views

Define specific color for each category_post

I'm looking to achieve something quite special and I can not manage to see where should I start, I need the same menu system has this website ( which is done with wordpress also, using reverie ...
0
votes
1answer
28 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
19 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
26 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
51 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
35 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
37 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
64 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
36 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
138 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
61 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
59 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 ...
0
votes
1answer
74 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
74 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
56 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
92 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
55 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
158 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
78 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
931 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
38 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
61 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
45 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
653 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 ...
1
vote
2answers
1k 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
72 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
107 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
116 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
58 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
47 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
249 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
2k 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
68 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
243 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
388 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" , ...
0
votes
1answer
195 views

get cat id is not working from custom taxonomy

I have a custom taxonomy "city". I am having a hard time to get cat id. the number. It's also custom post type "job" This works only for default category under the default post. $provinceID = ...
0
votes
3answers
825 views

How to order the get_categories result

I read the documentation of the codex but i can't order the get_categories() result just like parent,childrens. I have these kind of categories' three: -Events - Music - Culture - ...
0
votes
1answer
107 views

Hide categories from frontend, but not admin / post editor

I'm using the following code, placed in the functions.php of my theme, to hide certain categories used to organise posts and populate sliders from the posts themselves and their category listings: ...
0
votes
1answer
55 views

How do I get the parent category if I know the child category?

So Ive got this function here that creates a drop-down menu from only the child categories, it works great. The problem is that I need to get the parent categories name and assign it as the value of ...
0
votes
1answer
61 views

Loop Problem: Displays same set of post for all categories

So, I have 2 loops, one inside the other. The first to get the category titles, the second to display a few recent post from that category. Problem: Category titles display fine, but the recent post ...
0
votes
1answer
244 views

WooCommerce Hiding A Certain Category From Being Displayed On Single Product

If I go to wp-content/themes/theme-name/woocommerce/single-product/meta.php then I see this code:- <?php /** * Single Product Meta * * @author WooThemes * @package ...
0
votes
2answers
174 views

Display Random Thumbnail from Category

I have a feeling that I'm on the right track, I just don't have enough solid PHP knowledge to get much further than where I'm currently at. I'm currently using the following code to return a list of ...
0
votes
0answers
11 views

How to make category page as the home page? [duplicate]

In this forum I´ve found this thread http://bit.ly/17IuDBh but using the code in my WP MAXX theme doesn´t work. <?php query_posts('cat_id'=>'3');?> <--insert loop--> I have ...
0
votes
0answers
65 views

Replace get_the_category() with Hikari permalink

I want to edit my theme I have bought. I'm using the Hikari permalink plugin to set which category I want to have as the default (instead of lowest ID number). Now my theme just uses ...
-1
votes
1answer
1k views

List only child categories a post is in, of a specific parent category

Either this is harder than it needs to be or I am just not understanding WordPress/PHP very well :( All I want to do is show the child/sub categories of a specific parent category...but only if the ...
1
vote
0answers
558 views

get_categories listing foreach with children

My code for loop of categories <?php $categories = get_categories('hide_empty=1&exclude=1&orderby=slug&order=ASC'); foreach ($categories as $category) { echo '<li ...