![]() |
| Membuat Random Post di Wordpress |
Ok berikut Tutorialnya :
- Silahkan masuk Appareance di dashboard wordpress anda
- Sekarang pilih dimana anda ingin memasang random post.
- Umumnya/saya pribadi pasang di single.php
- Lalu kemudian pastekan kode berikut :
<h1>Random Posts:</h1>
<?php
$rand_posts = get_posts('numberposts=5&orderby=rand'); //angka 5 = jumlah postingan yang mau ditampilkan
foreach( $rand_posts as $post ) :
setup_postdata($post);
?>
<div class="post">
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
<div class="entry"><?php the_excerpt(); ?> </div>
<p class="postmetadata"><small><?php the_tags('Tags: ', ', ', '<br />'); ?> Posted on <?php the_time('F jS, Y') ?> under <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></small></p>
</div>
<?php endforeach; ?>
- Nah Jika sudah silahkan Save pekerjaan anda dan lihat hasilnya.
Jika ada eror silahkan laporkan disni dan akan saya bantu. Ok sekian tentang Membuat Random Post di Wordpress. salam

0 Response to "Membuat Random Post di Wordpress"
Posting Komentar