Problem displaying custom post type at home page
-
Hello, i’ve spent around 5 hours and can’t find a solution or help for my problem.
Maybe it is a simple issue, but i’m not a programmer ??This is the situation:
I have a custom post type called dd-product. I also have a custom taxonomy called productcat.
Now, in my home page i’m showing all posts from dd-product post type. For this, i’m using this code in my functions.php file:
add_filter( 'pre_get_posts', 'my_get_posts' ); function my_get_posts( $query ) { if ( is_home() && $query->is_main_query() ) $query->set( 'post_type', array( 'dd-product' ) ); return $query; }
What i want to do is to make a little bit different the posts from productcat category/taxonomy. Specifically, i want to change the title color for those posts with css (i have no problem with css)
I’ve tried with ‘if in_category’ and ‘if is_category’ but didn’t work. Maybe it will never work..
Note: the post type and the taxonomy have been created by a plugin. This plugin lets me add ‘posts’ under the new post type and category (taxonomy)
You can see the attached image: https://i.imgur.com/uR2N47d.png
How can I do that?
- The topic ‘Problem displaying custom post type at home page’ is closed to new replies.