Tutorial WP: Tampilkan Daftar Judul Berdasarkan Kategori Tertentu
Kode berikut gunanya untuk menampilkan daftar judul posting (tulisan) pada kategori tertentu.
<ul>
<?php query_posts(‘category_name=’.nama-kategori.’&post_status=publish,future’);?>
<?php if (have_posts()) : ?>
<?php query_posts(‘posts_per_page=20′); // batasi jumlah post yang ditampilkan ?>
<?php while (have_posts()) : the_post(); ?>
<li>
<a href=”<?php the_permalink() ?>” rel=”bookmark” title=”<?php printf(__(‘Permanent Link to %s’, ‘kubrick’), the_title_attribute(‘echo=0′)); ?>”>
<?php the_title(); ?>
</a>
</li>
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>
</ul>
Silahkan ganti nama-kategori dengan kategori yang diinginkan.
Artikel Lainnya:





