Hi!
I have found a plugin called Category show that I would like to implement in my archive.php page.
When clicking an archive link in my menu I would like to generate the code for my plugin.
I guess it's best to add an if-loop to my archive.php page.
I want something like this:
If category = 9 then
My code here for category 9
elseif category = 212 then
My code here for category 212
else
The usual code that is in archive.php
end if
The code in archive.php looks like this:
<?php get_header(); ?>
<div id="content">
<div id="column">
<?php if (have_posts()) : ?>
<div class="post_header">
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a category archive */ if (is_category()) { ?>
<h1>Arkivet för kategorin ‘<?php single_cat_title(); ?>’</h1>
<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
<h1>Inlägg taggade med ‘<?php single_tag_title(); ?>’</h1>
<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
<h1>Arkivet för <?php the_time('F jS, Y'); ?></h1>
<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<h1>Arkivet för <?php the_time('F, Y'); ?></h1>
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<h1>Arkivet för <?php the_time('Y'); ?></h1>
<?php /* If this is an author archive */ } elseif (is_author()) { ?>
<h1>Författararkiv</h1>
<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<h1>Arkiv</h1>
<?php } ?>
</div>
<?php while (have_posts()) : the_post(); ?>
<div class="post">
<h2><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
<div class="postinfo">
<div class="info">Skrivet av <?php the_author_posts_link(); ?> on <?php the_time('j F, Y'); ?></div>
<div class="commentnum"><?php comments_popup_link('Inga kommentarer än', '1 kommentar', '% kommentarer'); ?></div><div class="clear"></div>
<?php if(function_exists('the_views')) { the_views(); } ?>
<?php if(function_exists('the_ratings')) { the_ratings(); } ?>
</div>
<div class="category">Inlägget tillhör kategori: [ <?php the_category(', '); ?> ]</div>
<div class="entry">
<?php the_excerpt(); ?><div class="clear"></div>
<p><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="more-link">Läs hela inlägget...</a></p>
</div>
<?php the_tags('<div class="tags">Taggar: [ ', ', ', ' ]</div><div class="clear"></div>'); ?>
</div>
<?php endwhile; ?>
<!-- Plugin Navigation -->
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
<!-- End -->
<?php else : ?>
<div class="post">
<h1>No posts were found.</h1>
<p>Sorry! the page you are looking for does not exist.</p>
<h3>Blog Search</h3>
<?php include(TEMPLATEPATH."/searchform.php"); ?>
</div>
<?php endif; ?>
</div>
<?php get_sidebar(); ?>
<div class="clear"></div>
</div>
<?php get_footer(); ?>
Anybody able to help me out?