1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

how to show category description only on first category page ?

Discussion in 'WordPress' started by skin1607, Dec 19, 2012.

  1. #1
    I have categories on my blog that are paged. I want to show the Category Descriptions on Page 1 of the category pages. How can I achieve this ?

    Any help will be appreciated. Thanks.
     
    skin1607, Dec 19, 2012 IP
  2. ashishkg

    ashishkg Active Member

    Messages:
    233
    Likes Received:
    8
    Best Answers:
    3
    Trophy Points:
    68
    #2
    use this <?php echo category_description( $category_id ); ?>
     
    ashishkg, Dec 22, 2012 IP
  3. Deluxious

    Deluxious Greenhorn

    Messages:
    32
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    18
    #3
    In the archive.php file of your theme, use the get_query_var and is_category functions too.

    Could look something like this

    
    <?get_header()?>
    <?
    if (is_category()) {
      $page = (get_query_var('paged')) ? get_query_var('paged') : 1;
      if ($page == 1) {
        echo category_description(); //you don't need to include the category id on the actual category page - wordpress figures it out. 
      }
    }
    ?>
    
    Code (markup):
     
    Deluxious, Dec 22, 2012 IP
  4. skin1607

    skin1607 Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #4
    sorry for responding late, but your solutions worked. thanks a lot, friends !
     
    skin1607, Dec 25, 2012 IP