How To Add Descriptions In Categories Post

Discussion in 'WordPress' started by mlao, Jun 20, 2010.

  1. #1
    mlao, Jun 20, 2010 IP
  2. mlao

    mlao Active Member

    Messages:
    321
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    Know one really knows?
     
    mlao, Jun 21, 2010 IP
  3. bhuthecoder

    bhuthecoder Member

    Messages:
    245
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    43
    #3
    hi,
    add this code
    <div class="entry"><?php the_content("[...]"); ?></div> 
    Code (markup):
    to the file category.php in ur themes directory after the line no "16"
     
    bhuthecoder, Jun 22, 2010 IP
  4. mlao

    mlao Active Member

    Messages:
    321
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #4
    Worked... But with problems, Ads apear and looks bad!
     
    mlao, Jun 22, 2010 IP
  5. bvraghav

    bvraghav Member

    Messages:
    123
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    33
    #5
    in your category.php, use
    <?php echo category_description(); ?>
    PHP:
    wherever you desire the output to be.

    refer to http://codex.wordpress.org/Function_Reference/category_description for further usage
     
    bvraghav, Jun 22, 2010 IP
  6. bhuthecoder

    bhuthecoder Member

    Messages:
    245
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    43
    #6
    if u want short description to display then replace
    <?php the_content("[...]"); ?>
    Code (markup):
    with
    <?php the_excerpt(); ?>
    Code (markup):
     
    bhuthecoder, Jun 22, 2010 IP
  7. mlao

    mlao Active Member

    Messages:
    321
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #7
    I have allready

    <?php the_excerpt(); ?>
    Code (markup):
    Is too short for description.

    bvraghav

    This code:
    [B]<?php echo category_description(); ?>[/B]
    Code (markup):
    is not for post description but for categories, so it gives the same description to all of posts
     
    mlao, Jun 22, 2010 IP
  8. bhuthecoder

    bhuthecoder Member

    Messages:
    245
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    43
    #8
    u can change the length of the description by changing the value of excerpt in functions.php file (located in ur theme folder) line no 41

    Example:
    "$excerpt_length = 6;" to "$excerpt_length = 100;"
    Code (markup):
     
    Last edited: Jun 22, 2010
    bhuthecoder, Jun 22, 2010 IP
  9. mlao

    mlao Active Member

    Messages:
    321
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #9
    Thank you, bhuthecoder

    So simple and worked....
     
    mlao, Jun 22, 2010 IP