1

I have a category.php file in my theme. Now the problem is in wordpress category can be of many things.

Like there is a default blog post category. Then there are category for custom post types, like portfolio, logo etc.

Now for all of these categories the same category.php file gets fired.

But in my category.php I'm trying to show something only if it is the category of main blog post type. If it is the category of any other custom post types, then that thing will now show up.

Is there is way to check if the category is of default blog post type or some custom post types?

So that I can do something like this:

if( this is the category of the main blog post type ) {
// then show what I want
} else {
// don't
}

Thanks in advance.

1 Answer 1

1

So basically you want to use the category.php for a particular post_type's category, right ? I think you can make sure the thing like below-

if( 'your-main-blog-post-type' == get_post_type() ) {
    // then show what I want
} else {
    // don't
}

Use above logic in your category.php and I hope you'll get the solution you're looking for.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.