PHP Code Snippet für Themes welches die Artikel einer bestimmten Kategorie auflistet.
Variante 1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
/* * Latest posts ordered by title, sorted alphabetically in ascending order. * Display: post date, title and excerpt */ $args = array( 'posts_per_page' => 10, 'orderby' => 'modified', // date, title, modified 'order' => 'DESC' , 'category' => $custom_field_value ); $postslist = get_posts($args); print '<ul class="ui list">'; foreach ($postslist as $post) : setup_postdata($post); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endforeach; wp_reset_postdata(); print '</ul>'; |
Variante 2
1 2 3 4 |
<?php query_posts('category_name=CATNAME&showposts=5'); ?> <?php while (have_posts()) : the_post(); ?> <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php endwhile; ?> |