Hey guys and gals! I've searched high and low for this and I just can't find a solution.
I'm trying to find a functions.php code that will print the "Attributes" Order number I assign to a custom post type or page to the article HTML classes I can then style with CSS.
<article itemtype="http://schema.org/CreativeWork" itemscope="itemscope"
class="post-39 custom-post-type-example type-custom-post-type-example status-publish format-standard entry odd">
In the above example CPT "Custom Post Type Example" if I assign a post with Attribute 4, I need it to add a class rank4 or similar.
I figured out how to add odd/even to this (as bolded) through searching here:
//* Add Odd/Even Class to WordPress Posts
add_filter ( 'post_class' , 'oddeven_post_class' );
global $current_class;
$current_class = 'odd';
function oddeven_post_class ( $classes ) {
global $current_class;
$classes[] = $current_class;
$current_class = ($current_class == 'odd') ? 'even' : 'odd';
return $classes;
}
Any way to add the attribute order as well? This will take my design to the next level. Thank you.