Articles of categories

Have posts that belong to multiple categories, exclude some categories from homepage

So I have categories A, B, C and D. And also categories 1, 2, 3 and 4. I have posts that can belong to any four of these categories. But I want to exclude anything in categories B, 4 and D from the homepage (and only from the homepage), even though they are also in […]

How to remove the category from post slug

I want to remove the category from post slug, for example a post slug like “http://my_site.com/uncategorized/hello-world/” would become “http://my_site.com/hello-world/”. My search only gives results about how to remove the word “category” from slugs, which is a different problem.

Pagination on child category returns 404

Can anyone figure out why viewing pages in my child categories results in a 404, when the same $paged code works fine for my index file? This is inside of my category-15.php (it’s to affect all child categories under parent category ID 15). <?php $PostNum = 1; $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $args […]

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 show all the child categories on one template without the parent showing as well. […]

Change the background of each post according to the category

I am using the Hueman Theme. What I want to do is that the background of all the posts should change according to the category of the post. Please suggest something

Anchor tag generates blank href attribute using echo esc_url( )

Following is my categories page. It’s listing the all categories in the page. But when <a href> gets blank value here. see the attached screen shot. Why href is blank here li><a href=”<?php echo esc_url( $category_link ); ?>”><?php echo $cat- >name; ?></a></li> Here the the complete code <? php /* Template Name: Categories */ get_header(); […]

ID of last created category

How to get ID of last created category? I tried use this to for loop, which displays the posts in category boxes.

List child categories from parent category on custom taxonomy page

I making some updates to a theme I’m currently working on. I’ve moved a bunch of categories that have custom post items under them into a parent category that’s all within a custom taxonomy. e.g.: Parent Category -Child Category –Item –Item –Item -Child Category –Item –Item -Child Category –Item –Item –Item I’m able to list […]

the_category() tag not styling HTML or CSS

I am having problems getting my the_category() template tag to style accordingly with the rest of my theme. I believe this is because the HTML isn’t output the same way as the the_author() and the_comments() tags. I’ve looked into my category_template.php file but am having trouble identifying what exactly I need to tweak to get […]

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’, ‘3’, ) ) { echo “This post is in the selected categories or their subcategories”; } else { echo […]