I will give you here a code to list only one post per selected category. You could include this code into your index.php to query for the last posts of the categories you put into this code.
The first and the last line makes the post appear only on first page.
In the array of categories are six numbers now which you have to replace with the category IDs of your categories. It could be more or less, order them as you wish.
<?php if(!is_paged()) { // display only on page one if is not paged ?>
<?php $display_categories = array(8,5,4,6,7,3); foreach ($display_categories as $frontcats) { ?>
<?php $catposts = get_posts("showposts=1&cat=$frontcats"); foreach($catposts as $post) : setup_postdata($post); ?>
<h3 class=cat_title><a href="<?php echo get_category_link($frontcats);?>"><?php $this_category = get_category($frontcats); ?><?php echo $this_category->cat_name; ?> »</a></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');?></div>
<?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 $values[0]; ?>" alt="<?php the_title(); ?>" /></a>
<?php } //end of image if set in custom field ?>
<?php the_excerpt(); ?>
<?php endforeach; // end of post ?>
<?php } ?>
<?php } // end of FIRST PAGE ?>
Actually I made this query for Arthemia theme, if you want you find the complete modified index.php renamed as arthemia_onepostpercat_index.txt here:
arthemia index.php modified to dispay one post per category on first page
This file is an Arthemia index.php and will show on the first page only one post of each selected category.
Pagination should work and will show you on page two the list of posts as you set them in the theme. Here you are again free to choose any category to exclude as normally done in this theme.
one post per category wordpress Benutzergruppen in WordPress Google Adsense Googlemail und youtube so langsam heute List one latest post per category on frontpage view Add Adsense between some Posts in WordPress you do not have a category slug.php (lets say category news.php) WordPress Heres how to do that for one post: Upload an image thetime(m).authornameadmincat1postsper I will give you here a code to list only selected . You could include this into your index.php query for the last s of categories put code. The first page (with Continue reading http://wpbtips..com/ In the majority of themes s on or other archive pages show up just as Tags: posts, page, wordpress, tips, Hi there I have been searching for a clean solution for the following: On my frontpage I want to show (the most recent) . If I have five categories I
March 4, 2009 um 07:29 Uhr
Hi JW, I use this script but I have a problem. When I select the categories it only shows the title and the name of the category, but the text of the lastest news of every one of the category do not correspond to this category.
March 4, 2009 um 16:02 Uhr
Marcos, thanks for the hint, I updated the code and hope it works now.
changes in the index.php for arthemia are in lines: 76, 77 and 79 and one additional line in 92
April 22, 2010 um 22:48 Uhr
i want photo & clip
December 5, 2010 um 23:57 Uhr
Hello, dear Autor!
If I include your code into my index.php I get an error due to some errors in your function. I am not really good in php, but could you take a look please?