• Resolved Ry4nrc

    (@ry4nrc)


    Hi everyone

    I have a problem and i have no idea how to make this work, i am trying to add a description to my category pages (not archives) i have searched for about two hours trying to make this work but to no luck.

    I am using the elegant themes, delicate news template and it does not use a archive.php if that helps.

    I have tried the <?php echo category_description( $category_id ); ?> but do not know exactly where it goes and it should be in the archive.php

    Any help would be greatly appreciated. Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Does it have a category.php?

    <?php global $cat; ?>
    <?php echo category_description( $cat ); ?>

    If no category.php or archive.php in index.php

    <?php if( is_category() ) : ?>
       <?php global $cat; ?>
       <?php echo category_description( $cat ); ?>
    <?php endif; ?>

    HTH

    David

    Thread Starter Ry4nrc

    (@ry4nrc)

    Thank you so much that worked a treat.

    I also added

    <!-- category-title -->
    <?php global $post; $category = get_the_category($post->ID); echo $category[0]->name; ?>

    For the category title

    I am trying to style the title and description now as it is very small, i have tried the “Allow HTML in description” plugin and similar ones but that does not work.

    I am wanting the category title to be h1 and the text to be smaller, i have tried linking the new php line to a new class in my ccs file my cannot get it to work.

    You are the man, hope you can help with this one. Thanks

    Thread Starter Ry4nrc

    (@ry4nrc)

    Oh yes you can see the size of the text Here right under the logo, and for anyone that is having problems with this, i added the code to the index.php

    Just under

    <?php global $query_string;
    			if (is_category()) query_posts($query_string . "&showposts=$post_number&paged=$paged&cat=$cat");
    			else query_posts($query_string . "&showposts=$post_number&paged=$paged"); ?>

    Hi Rynrc,
    Glad you have it sorted, mark this as resolved please.

    I am wanting the category title to be h1 and the text to be smaller, i have tried linking the new php line to a new class in my ccs file my cannot get it to work

    Have a look at how the current titles are rendered, and get_cat_name($cat), to style the title change the class name and copy and rename an existing style block to your class name.

    <h1 class="cat-title">
    <!-- category-title -->
    <?php global $cat; echo get_cat_name( $cat ); ?>
    </h1>

    Style:

    .entry h1.cat-title {
        color: #757575;
        font-size: 20px;
        margin-bottom: 10px;
    }

    Note:
    As it is a category the WordPress template heirarcy will find the first of category-{$slug}.php, category.php, archive.php and index.php so saving index.php as category.php and making the changes will mean you will not need the is_category() condition and maintain the index.php.

    I recently enchanced the categories to use a custom posts for the description.

    HTH

    David

    Thread Starter Ry4nrc

    (@ry4nrc)

    Thank you David, all is well now.

    Thanks for all the great help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to actally show category description’ is closed to new replies.