Webdesign – go41

Category view in Arthemia optimized

Category view in Arthemia optimized

Question: Can you display headline & featured block to each category and sub-category with different content like Arthemia already have on frontpage?
Answer: There is of course a way.

Category view in Arthemia optimized

Arthemia Theme Demo Screenshot

WordPress takes in Arthemia theme the file archive.php if you select any kind of archive.
To get a special view for categories you could duplicate the archive.php and call it category.php. Then wordpress will take that file for category view and you can change this file to fit your requirements.
Now, lets say you duplicate index.php and call the new file category.php, WordPress will take that file to view the category with headline and featured as on frontpage.
If you want only one certain category being displayed different only you can even check the ID of that category and name the new file category-6.php or category-2.php etc.
see: codex.wordpress.org/Category_Templates for more information on wordpress templates.
Now the question which post should be the Headline for a Category?
There are multiple ways to query a certain post from the current category, be it by title of the post, or a post with a custom field or the latest post (easiest) etc.
I decided to query for the very first post in that category, this means the oldest on. Now it’s possible to create a headline post lust by giving it a publishing date older than the first post in that category.
I used the index.php of Arthemia Theme (not Arthemia Premium!) and modified only the queries for Headline (oldest post of category) and modified the query of posts being displayed below to run like normal archive view, eg. newest (latest) post on top.
I copy the content of arthemia theme category.php here and give you the link to that file as text file what you can find here category.txt

<?php get_header(); ?>

<?php if(!is_paged()) { ?>

<div id=”top” class=”clearfloat”>

<div id=”headline”>
<img src=”<?php echo get_option(‘home’); ?>/wp-content/themes/arthemia/images/headline.png” width=”75px” height=”21px” alt=”" />
<?php if (is_category()) {
$id = get_query_var(‘cat’);
$postslist = get_posts(“cat=’ . $id . ‘&numberposts=1&order=ASC&orderby=date”);
foreach ($postslist as $post) :
setup_postdata($post); ?>
<div class=”title”><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a></div>
<div class=”meta”>[<?php the_time('j M Y') ?> | <?php comments_popup_link('No Comment', 'One Comment', '% Comments');?> | <?php if(function_exists('the_views')) { the_views(); } ?>]</div>
<?php $values = get_post_custom_values(“Headline”);?>
<a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”>
<img src=”<?php echo bloginfo(‘template_url’); ?>/scripts/timthumb.php?src=<?php echo get_option(‘home’); ?>/<?php
$values = get_post_custom_values(“Image”); echo $values[0]; ?>&w=300&h=275&zc=1&q=100″
alt=”<?php the_title(); ?>” class=”left” width=”300px” height=”275px” /></a>
<?php the_excerpt(); ?>
<a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”>Read the full story &raquo;</a>
<?php endforeach; ?>
<?php } ?>
</div>

<div id=”featured”>

<img src=”<?php echo get_option(‘home’); ?>/wp-content/themes/arthemia/images/featured.png” width=”72px” height=”17px” alt=”" />
<?php query_posts(“showposts=4&category_name=Featured”); $i = 1; ?>

<?php while (have_posts()) : the_post(); ?>
<div class=”clearfloat”>
<?php $values = get_post_custom_values(“Image”);
if (isset($values[0])) { ?>
<a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”>
<img src=”<?php echo bloginfo(‘template_url’); ?>/scripts/timthumb.php?src=<?php echo get_option(‘home’); ?>/<?php
$values = get_post_custom_values(“Image”); echo $values[0]; ?>&w=100&h=65&zc=1&q=100″
alt=”<?php the_title(); ?>” class=”left” width=”100px” height=”65px” /></a>
<?php } ?>
<div class=”info”><a href=”<?php the_permalink() ?>” rel=”bookmark” class=”title”><?php the_title(); ?></a>
<?php the_excerpt(); ?>
</div>
</div>

<?php endwhile; ?>

</div>

</div>

<div id=”middle” class=”clearfloat” >
<img src=”<?php echo get_option(‘home’); ?>/wp-content/themes/arthemia/images/category.png” class=”clearfloat” alt=”" />
<?php $display_categories = array(1,3,4,49); $i = 1;
foreach ($display_categories as $category) { ?>

<div id=”cat-<?php echo $i; ?>” class=”category”>
<?php query_posts(“showposts=1&cat=$category”); ?>
<span class=”cat_title”><a href=”<?php echo get_category_link($category);?>”><?php single_cat_title(); ?></a></span>
<a href=”<?php echo get_category_link($category);?>”><?php echo category_description($category); ?></a>
</div>

<?php $i++; ?>
<?php } ?>
<?php wp_reset_query(); ?>
</div>

<?php } ?>

<div id=”bottom” class=”clearfloat”>

<div id=”front-list”>

<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post();if( $post->ID == $do_not_duplicate ) continue; ?>

<div class=”clearfloat”>
<h3 class=cat_title><?php the_category(‘, ‘); ?> &raquo</h3>
<div class=”title”><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a></div>
<div class=”meta”>[<?php the_time('j M Y') ?> | <?php comments_popup_link('No Comment', 'One Comment', '% Comments');?> | <?php if(function_exists('the_views')) { the_views(); } ?>]</div>

<div class=”spoiler”>
<?php $values = get_post_custom_values(“Image”);
if (isset($values[0])) { ?>
<a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”>
<img src=”<?php echo bloginfo(‘template_url’); ?>/scripts/timthumb.php?src=<?php echo get_option(‘home’); ?>/<?php
$values = get_post_custom_values(“Image”); echo $values[0]; ?>&w=150&h=150&zc=1&q=100″
alt=”<?php the_title(); ?>” class=”left” width=”150px” height=”150px” /></a>
<?php } ?>

<?php the_excerpt(); ?>
</div>

</div>

<?php endwhile; ?>

<div class=”navigation”>
<?php if(function_exists(‘wp_pagenavi’)) { wp_pagenavi(); }
else { ?>

<div class=”right”><?php next_posts_link(‘Next Page &raquo;’) ?></div>
<div class=”left”><?php previous_posts_link(‘&laquo; Previous Page’) ?></div>
<?php } ?>

</div>
<?php else : ?><h2 class=”title”>No posts found. Try a different search?</h2><?php endif; ?>
</div>

<?php get_sidebar(); ?>

</div>

<?php get_footer(); ?>

category template wordpress optimized Archive for the Wordpress Themes Category Foundation of any Smart WordPress Design: Genesis is Search Engine Optimized Powerpoint Templates Wordpress Themes Best WordPress Template Blog Best SEO/Ads/Speed optimized Themes Template for WordPress the Number of Posts to show per Category page in the Best WordPress Templates Free s for . We provide premium The Game Player is a premium theme that belongs to the gaming . SEO Super Cache Ready No Plugins Best SEO/Ads/Speed Themes for the Number of Posts to show per page in the Best s Tags: listlatest, posts, category, wordpress, : Blogger Themes Themes 8 Responses to Free Adsense Blogger

Related Entries

List one latest post per category on frontpage view

List some pages with content in WordPress

list pages custom styling in arthemia category bar

List subcategories in category bar of arthemia theme

Exclude one headline post from frontpage but not if is paged

Autor: JW

Freelance Webdeveloper Website Questions? Please ask in Webdesign Forum

Kommentare sind deaktiviert.

Website Questions? Please ask in my Webdesign Forum