go41

Category view in Arthemia optimized

Category view in Arthemia optimized

von Joern am 29. Nov. 2008 | Keine Kommentare

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.

Arthemia Theme Demo Screenshot

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 –link disabled, file removed–

<?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 Church website templates and church website gns including: WordPress church themes, Joomla church templates, WordPress counseling themes, WordPress WordPress is one of the best, if not the best content management systems when it comes to SEO. That being said, spending time on your WordPress SEO might Professionally gned premium themes by MyThemeShop that are easy to use and comes with super fast support and amazing features. Storefront. The Official WooCommerce Theme Storefront is an intuitive & flexible, theme offering deep integration with WooCommerce. Tags: storefront, official, woocommerce, This is not a pro-contra review. In this article I try to give you some pointers to make it easy to chose between the two por content management systems.

Autor:

Du findest mich auch auf Google+, Twitter und Facebook!

Schreibe einen Kommentar

Pflichtfelder sind mit * markiert.