Custom Post Types & Taxonomies - Missing Styling in listing

General questions pertaining to how certain issues can be resolved
Forum rules
1. No offensive language and no mocking
2. Please do a thorough search before you post something. Trust us, there is a high probability that the question you are asking has been asked previously.
3. No soliciting. You cannot post here soliciting bids for people offer you quotes, or even offer money to people for some work. You will be moderated if you do so. If you are looking for help, please post your request on http://jobs.wordpress.net or http://codepoet.com
4. Please be reasonable. You are getting software and support. For free. Complicated requests from a general purpose theme are not welcome and some volunteers might lose patience with you.
5. Please do your due diligence. If you posted a query and we answered with a link, take the trouble to go through the link contents.
6. Please post with complete information. Requests for help MUST be accompanied with your URL, particularly if you are asking something like "Why am I seeing a blank space?"

Custom Post Types & Taxonomies - Missing Styling in listing

Postby tedkaiser » 17 May 2011, 21:15

Hi,

I've created a Custom Post Type - Reviews and a Taxonomy - Review Types to support three categories of reviews. In the Suffusion Custom Types config panel, I've chosen to Inherit styles from: Post. This seems to be working fine when reading a single review post at a time.

However, I've created a Reviews page and a WP3.0 menu with the Reviews page at the top and the three review types I set up as subitems and configured the main navigation bar to display Reviews as a drop down with the three review types as submenu items. This works too - I can drop down Reviews and choose one of the three categories and I do get a page which displays matching Reviews. The only problem is styling. Unlike with posts selected from categories (on my site, eg. under Blog, Photo Equipment) which use styling which shows post styling with each post listed, on the custom post lists, there does not appear to be any styling being applied.

When I inspect elements on the page which lists posts by category, each post entry in the list has the corresponding Matched CSS Rules of .post, div.page etc. But, on the custom post/taxonomy page listing reviews by review category, each post entry doesn't seem to have any corresponding Matched CSS Rule.

Using one of the dark color schemes, posts are in a black box on a grey background for categories. But, for the custom posts/taxonomies, there is no black box. I've attached a screenshot:
Attachments
TaxonomyListNoBlackBoxs.png
TaxonomyListNoBlackBoxs.png (228.71 KiB) Viewed 547 times
tedkaiser
 
Posts: 5
Joined: 11 Apr 2011, 20:53

Re: Custom Post Types & Taxonomies - Missing Styling in list

Postby sayontan » 17 May 2011, 23:45

That will need some modifications to the code. You can add this code to a child theme's functions.php:
Code: Select all
add_filter('post_class', 'my_custom_class',11,3);
function my_custom_class($classes, $class, $id) {
    global $post;
   $custom_class = "";

   if ($post->post_type != 'post' && $post->post_type != 'page') {
      // Custom post type. See if there is style inheritance
      $suffusion_post_types = get_option('suffusion_post_types');
      if (is_array($suffusion_post_types)) {
         foreach ($suffusion_post_types as $suffusion_post_type) {
            if ($suffusion_post_type['style_inherit'] != 'custom') {
               $custom_class = $suffusion_post_type['style_inherit'];
            }
         }
      }
      if ($custom_class == "") {
         $custom_class = "post";
      }
   }
    $classes[] = $custom_class;
    return $classes;
}
Sayontan Sinha | http://mynethome.net/blog | http://www.aquoid.com/news
I don't do freelance work (for Suffusion or otherwise), so please don't contact me for quotes or offers.
sayontan
Site Admin
 
Posts: 10159
Joined: 15 Sep 2009, 16:39
Location: Houston, Texas

Re: Custom Post Types & Taxonomies - Missing Styling in list

Postby tedkaiser » 18 May 2011, 17:58

You, sir, are a genius!

Thanks again!!!
tedkaiser
 
Posts: 5
Joined: 11 Apr 2011, 20:53


Return to Support Requests

Who is online

Users browsing this forum: Google [Bot], Nuateauthow and 2 guests

cron