• Hello. I try to create different classes depending on the category name. I have the following code:

    elseif($value == ‘PozaSus’) {

    echo “”.get_the_post_thumbnail($post_id, ‘thumbnail’, array(‘class’ => ‘img-thumb-left-hot’)).”.'<h2 class=”postTitleblue”>’.get_the_title().'</h2><span class=”subNewsContainerMeta1″></span>’;
    echo ‘<div class=”<?php get_category( $category, $output, $filter ) ?>”>’.get_the_time(‘F j, Y’).'</div>’;
    echo ‘<h2 class=”datapost”>’.get_the_time(‘F j, Y’).’;by ‘.get_the_author().’; actualizat: ‘.get_the_modified_time(‘j M H:i’).'</h2>’;
    echo get_the_excerpt();
    echo ‘<span class=”subNewsContainerMeta1″></span><h9>read all</h9>’;

    } else

    The line of code that is not working

    echo ‘<div class=”<?php get_category( $category, $output, $filter ) ?>”>’.get_the_time(‘F j, Y’).'</div>’;

    Does anyone have any idea?

Viewing 1 replies (of 1 total)
  • Vishnupriya Natarajan

    (@vishnupriya-natarajan)

    Try this code:

    $cat = get_category( get_query_var( ‘cat’ ) );
    $cat_name = $cat->cat_name;

    echo ‘<div class=”‘;
    echo $cat_name;
    echo ‘”>’.get_the_time(‘F j, Y’).'</div>’;

Viewing 1 replies (of 1 total)
  • The topic ‘difrent style class for difrent category’ is closed to new replies.