Support

Tag archive (10 posts)

Languages

de | fr | es | 日本語

About This Topic

Tags

  1. rss Lise

    new member


    rss Posted 4 years ago
    #

    I´m using your Nature theme, that I´ve modded. It works just fine, except for one thing. I´ve created a tag.php to show the tag archive, but then the left sidebar shows all the last for pages and posts I´ve created, instead of only the last for posts from the categories I selected. On all other pages and archives I´don´t have this problem.

    The URL is http://www.helikonsymfonieorkest.nl

  2. rss milo

    moderator


    rss Posted 4 years ago
    #

    Please post the tag template code here (cut and paste with backticks) or send it to my mail adress (milo317[at]googlemail[dot]com), so I can take a further look into it.
    We might use 'conditional' tags in the sidebar to show the relevant posts.
    Examples:

    
    is_tag()
    
    
    
    
    
    is_tag('slug')
    
    
    
  3. rss Lise

    new member


    rss Posted 4 years ago
    #

    This is the code in tag.php:

    EDIT: somehow posting of code doesn't work. I'll e-mail the template to you.

    On re-reading my first post I thought I should clearify myself. What I want to appear in the sidebar are the latest posts I published in the categories with ID's 1 and 2.

  4. rss milo

    moderator


    rss Posted 4 years ago
    #

    I am still working on the tag related problem, it will work on category based conditionals, but not on tag conditions.

    However there is an easy solution with a special sidebar, interested?

  5. rss Lise

    new member


    rss Posted 4 years ago
    #

    Of course I'm interested!

  6. rss milo

    moderator


    rss Posted 4 years ago
    #

    Files are in the post, please check your in mail.

  7. rss milo

    moderator


    rss Posted 4 years ago
    #

    Ok, this is the prob:
    your tag template states this call:
    ? php $ post = $ posts [ 0 ] ; / / Hack . Set $ post so that the _ date ( ) works . ? >

    < ? php / * If this is a tag archive * / if ( is _ tag ( ) ) { ?
    It's calling for the tag archive, while the sidebar acts like this:
    ? php / * If this is a monthly archive * / } elseif ( isset ( $ _ GET [ ' paged ' ] ) & & ! empty ( $ _ GET [ ' paged ' ] ) ) { ?

    Try one of the following php calls, add this BEFORE the category call in the sidebar:
    < ? php / * If this is a tag archive * / if ( is _ tag ( ) ) { ? >
    < p > You are currently browsing the < a href = " < ? php echo get _ settings ( ' siteurl ' ) ; ? > " > < ? php echo bloginfo ( ' name ' ) ; ? > < / a > weblog archives for < ? php single _ tag _ title ( ) ; ? > . < / p >

    or this:
    < ? php / * If this is a tag archive * / } elseif ( is _ tag ( ) ) { ? >
    < p >You are currently browsing the < a href = " < ? php echo get _ settings ( ' siteurl ' ) ; ? > " > < ? php echo bloginfo ( ' name ' ) ; ? > < / a > weblog archives for < ? php single _ tag _ title ( ) ; ? > . < / p >

    considering you are using the actual sidebar template, that came with the theme.

  8. rss Lise

    new member


    rss Posted 4 years ago
    #

    Both calls don't work. But maybe that's because I've changed a few minor things in the sidebar code. This is the code I'm currently using:

    <? // LEFT SIDEBAR ?><div id="leftsidebar">

    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(1) ) : else : ?>

      <h2>Recent</h2>

      <?php $my_query = new WP_Query('cat=1,2&showposts=4'); ?>

      <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>

      <div class="post">

      <h2 id="post-<?php the_ID(); ?>"> " rel="bookmark" title="Link naar <?php the_title(); ?>"><?php the_title(); ?></h2>

      <?php the_content_rss('meer...', FALSE, 'more_file', 12); ?>

      <small >⊆<?php the_time('d m Y') ?></small>

      </div><?php endwhile; ?>

    <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?> <?php } ?>

    <?php endif; ?></div><? // END LEFT SIDEBAR ?>

    <? // RIGHT SIDEBAR ?><div id="rightsidebar">

    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?>

      <h2>Zoek</h2>

      <?php include (TEMPLATEPATH . '/searchform.php'); ?>

      <h2>Agenda</h2>

      <?php wp_dday_list(); ?>

      <?php st_tag_cloud(); ?>

      <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?><?php } ?>

    <?php endif; ?></div><? // END RIGHT SIDEBAR ?>

  9. rss milo

    moderator


    rss Posted 4 years ago
    #

    Not an easy resolution, but it might be the loop call:

    <?php $my_query = new WP_Query('cat=1,2&showposts=4'); ?>
    <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>

    Try this please instead:

    <?php
    query_posts('showposts=3');
    ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <h2>< a href = " < ? php the _ permalink ( ) ? > " rel= " bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h2>
    <div class="post">
    <?php the_content_rss('meer...', FALSE, 'more_file', 12); ?>
    <small>⊆<?php the_time('d m Y') ?></small></div>
    <?php endwhile; else: ?>

    PLEASE note the difference in last line:
    <?php endwhile; ?>
    to
    <?php endwhile; else: ?>

    Important, as the new loop won't work only with endwhile;

  10. rss milo

    moderator


    rss Posted 4 years ago
    #

    Code in post.

Reply

You must log in to post.

Design by milo

Milo designs web sites that strike the perfect balance between professional high-class graphics, functionality, usability, user experience, and high performance.