Das habe ich jetzt versucht.
Oben mit der news das geht. Da wird nur die neuste ausgegeben.
Index.php
<?php if (have_posts()) : ?>
<?php $do_not_duplicate = array(); ?>
<?php query_posts($query_string. "&cat=1&orderby=rand&showposts=1"); ?>
<?php while ( have_posts() ) : the_post(); $do_not_duplicate[] = get_the_ID(); ?>
<?php the_date('d.m'); ?> <a id="titel" href="<?php the_permalink() ?>">
<?php the_title(); ?></a>
<div class="entry" id="topnews"><?php the_content(); ?></div>
<?php endwhile; ?>
Alles anzeigen
Aber wenn ich die Box in die sidebar einfügen will dann sagt er mir einen fehler
Zitat
Parse error: syntax error, unexpected $end in /var/www/web132/html/demo/wp-content/themes/ltcmdr/index.php on line 82
In der Line 82 steht nur
sidebar.php
<?php $random_query = new WP_Query(array('post__not_in' => $do_not_duplicate, 'showposts' => 5, 'orderby' => 'rand', 'cat' => '1')); while ($random_query->have_posts()) : $random_query->the_post(); ?>
<?php the_date('d.m'); ?> <a id="titel" href="<?php the_permalink() ?>"><?php the_title(); ?></a>
<?php endwhile; endif; ?>