ich gebe per query_post nur ein artikel einer kategorie aus.
ist der artikel älter als 30 tage soll nichts ausgegeben werden. nun steht aber noch die überschrift h2 dar, welche dann nicht ausgegeben werden soll. hier mal mein momentaner code dazu.
PHP
<?php function filter_where($where = '') {
//posts in the last 30 days
$where .= " AND post_date > '" . date('Y-m-d', strtotime('-2 days')) . "'";
return $where;
}
add_filter('posts_where', 'filter_where');
if (have_posts()) :
query_posts($query_string.'showposts=1&cat=1'); ?>
<h2><?php wp_list_categories('include=1&title_li=&style=none'); ?></h2>
<?php while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h3><a href="<?php the_permalink() ?>" rel="bookmark" class="title">
<?php /* title of the "featured articles" */ the_title(); ?></a></h3>
<?php the_excerpt(); ?>
</div>
<?php endwhile;
endif; ?>
Alles anzeigen
ich brauche mal einen ansatz, wenn kein artikel ausgegeben wird, das auch die überschrift h2 entfällt.