• Hey i already managed to actually do it, i’m just trying here to improve it.

    After many tries this is what i have so far, i don’t know if is correct or not at least it works fine:

    <?php if ( is_category( $category )): ?>
    
    <div id="about-cat">
    <?php echo category_description( $category );
    ?> </div>
    
    <?php else: ?>
    
    <div id="about">
    blah blah blah
        </div>
    
    <?php endif; ?>

    I just wonder how can i add there another line if the cat description is empty to return something like this ‘Sorry, This album has no description.’ I already tried a few things and i can’t figure it out.

Viewing 2 replies - 1 through 2 (of 2 total)
  • <?php if ( is_category( $category )): ?>
    
    <div id="about-cat">
    <?php if( category_description( $category ) !='' ) echo category_description( $category );
    else echo 'Sorry, This album has no description.';
    ?> </div>
    
    <?php else: ?>
    
    <div id="about">
    blah blah blah
        </div>
    
    <?php endif; ?>
    Thread Starter vnatura

    (@vnatura)

    Thanks you very much, works great.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Category description on sidebar’ is closed to new replies.