WordPress.org

Ready to get started?Download WordPress

Forums

Custom Archive page? (1 post)

  1. manga
    Member
    Posted 4 years ago #

    Hello.

    I´m thinking about creating a custom archives template for the category archives.

    What I want to do is grab the 3 first posts of the current category, have a image thumbnail be created with timthumb and then the following posts are to remain as they are.

    The theme I´m using is Modicus Remix and this is how far I´ve gotten in code:

    <?php get_header(); ?>
      <h1><?php single_cat_title(); ?></h1>
      <br />
    <?php if (!is_paged()) { ?>
    <?php query_posts("showposts=3"); ?>
    <?php while (have_posts()) : the_post(); ?>
    
    <div id="boxkatsmall">
    
    <?php $values = get_post_custom_values("Image");?>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
    
    <img src="<?php echo bloginfo('template_url'); ?>/scripts/timthumb.php?src=/<?php $values = get_post_custom_values("Image"); echo $values[0]; ?>&w=168&h=120&zc=1&q=100" alt="<?php the_title(); ?>" class="left" width="168px" height="120px"/></a>
    
    <div style="clear: both;"></div>
    
    <!-- // <a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a> // -->
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
    <?php	$texter = get_the_excerpt();						if(strlen($texter ) > 60)
    {$texter = substr($texter , 0, 60);
    } echo '» '.$texter.'...'; ?></a>
    
    </div>
    
    <?php wp_reset_query(); ?>
    
    <?php endwhile ?>
    <?php } ?>
    
    <div class="post">
    
     <?php if (have_posts()) : ?>
      <?php while (have_posts()) : the_post(); ?>
    
      <div class="interviewtime"><small>
        <?php the_time('d M.y') ?>
        / <a href="/index.php?author=<?php the_author_ID(); ?>">
        <?php the_author_nickname(); ?>
        </a></small></div>
      <div class="interviewlist"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
        <?php the_title(); ?>
        </a></div>
      <br style="clear:both;line-height:5px;" />
      <?php endwhile; ?>
      <div class="navigation">
        <div class="alignleft">
          <?php next_posts_link('&laquo; Fler texter') ?>
        </div>
        <div class="alignright">
          <?php previous_posts_link('Nyare texter &raquo;') ?>
        </div>
      </div>
      <!-- end navigation -->
    </div>
    <!-- end post -->
    <?php endif; ?>
    <?php include (TEMPLATEPATH . '/sidebar.php'); ?>
    <?php get_footer(); ?>

    So what is left is to get the first query to work. As it is now it grabs the very first post of the blog and places it first before starting with the category posts.

    As well as ignoring the amount of posts. It shows the same amount of posts that I have told it to show in my settings.

    So what should I change to get the query to work as I want? And how to I write the second query to start of at post number 3 and then continue on. Even on the later pages?

    Can´t offer anything else than my thanks for this help.

Topic Closed

This topic has been closed to new replies.

About this Topic