1. Halo Guest, pastikan Anda selalu menaati peraturan forum sebelum mengirimkan post atau thread baru.

Cara Bikin Random Post gmn ya??

Discussion in 'Wordpress' started by akmalrizali, May 31, 2009.

Tags:
  1. akmalrizali

    akmalrizali Newbie

    Joined:
    Mar 16, 2008
    Messages:
    29
    Likes Received:
    1
    Location:
    Bintaro
    Mas, Om, Tante, Kakak, ada yang tau cara bikin random post ga??
    tolong dunk.. aku newbie niih.. :nangis:
     
  2. wisnoe

    wisnoe Ads.id Pro

    Joined:
    Mar 24, 2008
    Messages:
    489
    Likes Received:
    19
    kalo SQL nya sih kayak gini:
    Code:
    select * from artikel order by rand() limit 10
     
  3. summer

    summer Super Hero

    Joined:
    Dec 3, 2007
    Messages:
    3,208
    Likes Received:
    284
  4. labalabakoe

    labalabakoe Super Hero

    Joined:
    Jan 6, 2008
    Messages:
    920
    Likes Received:
    22
    Location:
    nomaden
    <?php $my_query = new WP_Query('orderby=rand&showposts=6');
    while ($my_query->have_posts()) : $my_query->the_post();
    ?>
    <li><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title2('', '', true, '400') ?></a></li>
    <?php endwhile; ?>

    coba dech ini...
     
  5. aleydoank

    aleydoank Super Hero

    Joined:
    Jun 6, 2009
    Messages:
    1,897
    Likes Received:
    43
    Location:
    Bandung
    whoaa.. tingkyu ah, walau bukan ane yang buka thread tapi inpo nya bisa ane pake,, hihi..
    maaf ni bukan curang,, :)

    oke deh, tingkyu ya...
     
  6. masadi

    masadi Super Hero

    Joined:
    Dec 12, 2010
    Messages:
    2,334
    Likes Received:
    144
    Location:
    mas-adi.com
    PHP:
    <?php $posts get_posts('numberposts=9&orderby=post_date');                
                foreach(
    $posts as $post) {
                
    setup_postdata($post);
                echo 
    '<li><a href="' get_permalink() . '" title="' get_the_title() . '">' get_the_title() . '</a></li>';
                }
                
    $post $posts[0];
                
    ?>
    Atau kode ini... :D
     
  7. infodeddy

    infodeddy Super Hero

    Joined:
    Nov 29, 2010
    Messages:
    1,639
    Likes Received:
    381
    Location:
    kalimantan selatan
    bagus-bagus ada kode php disini he he bisa dicoba
     

Share This Page