mohamed irfan
asked 9 years ago

hi
dominic

can u plz guide me achive this result

i want to use category style for post page also
for example http://demo.designwall.com/dw-focus/category/sport/
while i open any post under (sports) it should have the same look as sport page, the sports logo and color.

thanks in advance
irfan

1 Answers
Allen
answered 9 years ago

hi to archive that result, you can follow this instruction :
First: You open file inc\category-meta go to line 157 and change the function dw_category_color_class to

function dw_category_color_class($classes) {
    if( is_archive() || is_single() ) {
        $classes[] = 'color-category';
    }

    return $classes;
}
add_filter('post_class', 'dw_category_color_class');
add_filter('body_class', 'dw_category_color_class');

Next , open file functions.php go to line 154 , below that line you add these code :

if ( is_single() ) {
    $style = '';
    $category = wp_get_post_categories( get_the_id() );
    $options = dw_get_category_option( $category[0] );
    $style = isset( $options['style'] ) && $options['style'] != 'none' ? $options['style'] : false;
if ( $style ) {
    $url = 'assets/colors/'.$style.'/style.css';
    if( file_exists(DW_TEMPLATE_PATH . $url) ) {
            wp_enqueue_style( 'dw_focus_category_style', DW_TEMPLATE_URI . $url );
        }
    }
}

And make sure you put your post in right category and if you have problem with implementing this , you can leave your comment here, i’ll help you. Glad

irfan
replied 9 years ago

thanks a lot, it works

Powered by DW Question & Answer Pro