Articles of categories

Changing the category permalink structure

Hopefully another simple one, I have some nested categories, like this: – category-a – category-b -category-c The permalink for category-c is as follows: http://<domain>/category/category-a/category-b/category-c/ What I’d really like is for the permalink to not include any parent categories, instead it would become this: http://<domain>/category/category-c/ Is there a way this can be achieved? I have some […]

Adding category dropdown list to theme options page

I am tyring to add a category drop down list to my theme options page. I am try it this way: <p> Select a style from the list <?php $amp_categories_obj = get_categories(‘hide_empty=0′); $amp_categories = array(); foreach ($amp_categories_obj as $amp_cat) { $amp_categories[$amp_cat->cat_ID] = $amp_cat->category_nicename; } $categories_tmp = array_unshift($amp_categories, “Select a category:”); echo “<select name=’amp_options[amp_cat]’>”; foreach ($amp_categories_obj […]

Default Category Page not showing custom post type which has taxonomy category

I have created a custom post type ‘Gallery’ and assign Default ‘category’ of post taxonomy to this custom post type. register_post_type( ‘gallery’, array( ‘labels’ => array( ‘name’ => ‘Galleries’, ‘singular_name’ => ‘Gallery’, ‘add_new’ => ‘Add New Image Gallery’, ‘add_new_item’ => “Add New Gallery”, ‘edit_item’ => “Edit Gallery”, ‘new_item’ => “New Gallery”, ‘view_item’ => “View Gallery”, […]

Best/Correct way to add an option to a category

I’m currently writing my first plugin, which will let the site admin/editor use a different image as a background/header for each post/page, and I would also like to have defaults for each category. Here is where I’m not sure how to proceed: If for each post/page the image (which is an attachment, so is just […]

Filtering Children of the “uncategorized” Category out of the Loop?

I have some utility categories that are only used by my theme. To help separate these categories I place them all as children of uncategorized. How can I make sure that any call to wp_list_categories() excludes the child categories under “uncategorized” cat_id = 1? I want this to work even if the call wp_list_categories() comes […]

Check is category parent or not from its ID

question is simple (i don’t know is aswer too 😉 I just want to check that, does a category has child (or is ancestor) from its cat-id with a function. Eg. function check_category ($catid){……………//true if is ancestor, false if notreturn $result;} Note: I can only pass cat-id parameter for function because i need to use […]

Post belonging to many categories

I have a post that belongs to two categories (Drinks, Food). The post appears on category pages under /category/drinks and /category/food When I click on the post under category archive /category/drinks it takes me to a post page that’s in /food/ Is there any way to solve this in a way that the post stays […]

Exclude a category name using cat name

I’m trying to exclude a category because I have a post that i have in multiple post. How do I like for example I have a post in the categories lastest news and pictures but I want to exclude latest news and show only the pictures name. I tried using $category = get_the_category(); echo $category[0]->cat_name; […]

echo category description in single.php

i asked this on SO but got no where. i will try asking here. this works fine in category.php <?php echo category_description(the_category_id()); ?> but it does not work in single.php, just the category id shows up not the description. any ideas, how to get this done? thanks in advance Edit: in category: <?php echo strip_tags(category_description(4)); […]

List Child Categorie and hide the parent

Greetings! I’m trying to list child categories in a sidebar, but also hide the parent cat. I’m using this at the moment: <?php wp_list_categories(‘orderby=id&show_count=0&use_desc_for_title=0&child_of=5′); ?> This has a unfortunate effect of displaying ‘Categories’ above the list. Is there any way to get rid of this? Thanks