Calling Wordprss genius's again! Conditional includes on category page 1?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Angry Jew Cat - Banned for Life
    (felis madjewicus)
    • Jul 2006
    • 20368

    #1

    Calling Wordprss genius's again! Conditional includes on category page 1?

    I understand how to do a conditional include to display on many different pages, but I would like to have an included div associated to each category on my site. That's easy enough, but I would like that condition to include that the div should only be included on THE FIRST PAGE of the category display.

    Is that doable, or will my included div only be able to show on each page of the category listing?
  • fris
    Too lazy to set a custom title
    • Aug 2002
    • 55700

    #2
    not sure if you want an include or what, but you want to use the variable is_paged()

    Code:
    <?php if (is_category() && !is_paged()) { ?>
    
    <div class="stuff">
    blah blah
    </div>
    
    or
    
    <?php include (TEMPLATEPATH . '/showdiv.html'); ?>
    
    <?php } ?>
    Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

    Comment

    • Angry Jew Cat - Banned for Life
      (felis madjewicus)
      • Jul 2006
      • 20368

      #3
      Originally posted by fris
      not sure if you want an include or what, but you want to use the variable is_paged()

      Code:
      <?php if (is_category() && !is_paged()) { ?>
      
      <div class="stuff">
      blah blah
      </div>
      
      or
      
      <?php include (TEMPLATEPATH . '/showdiv.html'); ?>
      
      <?php } ?>
      What I want is a single area for includign a category description, but I only want it to appear at the top of the first page of the category results. Not the description on the top of every page under the category listing.

      I'll google the is_paged() variable now and see what it has to say. Never used it before. Might work.

      Comment

      • fris
        Too lazy to set a custom title
        • Aug 2002
        • 55700

        #4
        well that will do it
        Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

        Comment

        • fris
          Too lazy to set a custom title
          • Aug 2002
          • 55700

          #5
          if you wanted to do an automated msg with the cat name you would do something like this.

          Code:
          <?php if (is_category() && !is_paged()) { ?>
          <?php $catid = get_query_var('cat'); ?>
          <?php $catname = get_cat_name($catid);?>
          
          <div class="message">
          welcome to the archives for <?php echo $catname;?>
          </div>
          
          <?php } ?>
          Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

          Comment

          • Angry Jew Cat - Banned for Life
            (felis madjewicus)
            • Jul 2006
            • 20368

            #6
            cheers, thanks again fris

            Comment

            • fris
              Too lazy to set a custom title
              • Aug 2002
              • 55700

              #7
              no problem.
              Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.

              Comment

              Working...