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

Membuat Related Post Tanpa Plugin

Discussion in 'Wordpress' started by leniden, Oct 19, 2009.

  1. leniden

    leniden Super Hero

    Joined:
    Mar 22, 2008
    Messages:
    2,379
    Likes Received:
    402
    Location:
    Palembang
    Sperti yang sama2 kita tau bro. Plugin related post ini bisa menyebabkan hosting kita ditendang sama provider karena Related post bisa menyebabkan server overload (Khusus yang pake shared hosting). Apalagi kalo traffiknya udah lebih dari 1000uv/day.

    Kita bisa membuat related post tanpa plugin. Caranya.

    Paste kode ini dibawah <?php the_content('Continue reading...'); ?> pada file single.php

    <?php
    $this_post = $post;
    $category = get_the_category(); $category = $category[0]; $category = $category->cat_ID;
    $posts = get_posts('numberposts=6&offset=0&orderby=post_date&order=DESC&category='.$category);
    $count = 0;
    foreach ( $posts as $post ) {
    if ( $post->ID == $this_post->ID || $count == 5) {
    unset($posts[$count]);
    }else{
    $count ++;
    }
    }
    ?>

    <?php if ( $posts ) : ?>
    <div class="related_articles">
    <h2>Related Posts</h2>
    <ul>
    <?php foreach ( $posts as $post ) : ?>
    <li><a href="<?php the_permalink() ?>" title="<?php echo trim(str_replace("n"," ",preg_replace('#<[^>]*?>#si','',get_the_excerpt()))) ?>"><?php if ( get_the_title() ){ the_title(); }else{ echo "Untitled"; } ?></a> (<?php the_time('F jS, Y') ?>)</li>
    <?php endforeach // $posts as $post ?>
    </ul>
    </div>
    <?php endif // $posts ?>
    <?php
    $post = $this_post;
    unset($this_post);
    ?>


    Selamat mencoba
     
    inisip, workingonit, Diandra and 41 others like this.
  2. makemine

    makemine Super Hero

    Joined:
    Jul 4, 2009
    Messages:
    840
    Likes Received:
    41
    Location:
    Hospital
    Mantap.. dari wprecipes lgsung masuk sini
     
  3. _webBer

    _webBer Hero

    Joined:
    Mar 27, 2009
    Messages:
    610
    Likes Received:
    19
    Location:
    Undetectable
    seep..ini yg dicari :D thanks added :)
     
  4. family man

    family man Super Hero

    Joined:
    Sep 22, 2008
    Messages:
    906
    Likes Received:
    95
    Location:
    Mountain village, cileunyi
    related post yg YARPP itu ya? Baru tau kalo berbahaya.... thanks
     
  5. leniden

    leniden Super Hero

    Joined:
    Mar 22, 2008
    Messages:
    2,379
    Likes Received:
    402
    Location:
    Palembang
    Yup... Kalo traffic masih ratusan kagak masalah. Tapi kalo udah ribuan.. Pasti di warning ama pemilik server. Paling parah langsung di disable account nya.
     
  6. iqbalsandira

    iqbalsandira Super Hero

    Joined:
    May 22, 2009
    Messages:
    4,719
    Likes Received:
    1,092
    Location:
    Makassar
    kalo aizatto related post gimana tuh bro? :hmm:
     
  7. van_arista

    van_arista Konsultan Toko Online

    Joined:
    Aug 22, 2009
    Messages:
    3,348
    Likes Received:
    1,233
    Location:
    Surabaya
    aku pasang YARRP di hosting share hostgator, traffik aku 1.000-an, pernah ampe 5000 uv/day. tapi belum ada peringatan. gmn kira-kira bro kalo aku terusin ?
     
  8. leniden

    leniden Super Hero

    Joined:
    Mar 22, 2008
    Messages:
    2,379
    Likes Received:
    402
    Location:
    Palembang
    Aku pake yang itu bro. Malah kena tendang... Untung pihak server mudah di ajak kompromi dan host ku jalan lagi sekarang tanpa plugin related post.
     
  9. kifni41

    kifni41 Super Hero

    Joined:
    Aug 24, 2009
    Messages:
    1,045
    Likes Received:
    19
    Wah,,,
    Katanya YARP udah pake cache jadi ga begitu memberatkan..
    ternyata msih berbahaya ya..:hmm:
     
  10. danuakbar

    danuakbar Super Hero

    Joined:
    Oct 11, 2009
    Messages:
    3,145
    Likes Received:
    2,044
    makasih yah bos..
    patut d coba ne...
    supaya g kebanyakan plugin.. ^_^
     
  11. vistachan

    vistachan Super Hero

    Joined:
    Apr 28, 2009
    Messages:
    2,122
    Likes Received:
    336
    Location:
    somewhere far from indonesia
    hostgator aman ... sampai 10,000 uv / day ... masih belum jebol :silau:
     
  12. ddl4fun

    ddl4fun Super Hero

    Joined:
    Feb 25, 2009
    Messages:
    1,908
    Likes Received:
    105
    Location:
    /
    gw 10k/day gak ada masalah dengan fatcow :senyum:
    pake YARPP ...
     
  13. roeltw

    roeltw Super Hero

    Joined:
    May 7, 2009
    Messages:
    1,657
    Likes Received:
    733
    Location:
    wow-o.com
    ane jg 4000an uv/day di hostmonster, pake YARPP, STT2, Smart links, dll
    msh aman... :senyum:
     
  14. syahur

    syahur Super Hero

    Joined:
    May 8, 2008
    Messages:
    1,138
    Likes Received:
    71
    Location:
    Aceh
    ane pake contextual related post....
    simple tapi puas :silau:
     
  15. makemine

    makemine Super Hero

    Joined:
    Jul 4, 2009
    Messages:
    840
    Likes Received:
    41
    Location:
    Hospital
  16. raquo

    raquo AdSense Fan

    Joined:
    Oct 9, 2009
    Messages:
    220
    Likes Received:
    22
    Location:
    Balikpapan
    trimakasih, infonya berguna sekali :)
     
  17. buto galak

    buto galak New Comer

    Joined:
    Oct 18, 2009
    Messages:
    17
    Likes Received:
    0
    Baru tahu... :nangis:
    Makasih bos infonya
     
  18. caldenni

    caldenni Super Hero

    Joined:
    Nov 27, 2007
    Messages:
    902
    Likes Received:
    246
    Location:
    Pangkalpinang, Babel
    ane pake WP-related post plugin. Gabung sama STT2 dll di Hawkhost traffic total sktr 6000 uv/day ga masalah bro :gembira:
     
  19. blessfx

    blessfx Super Hero

    Joined:
    Jan 9, 2009
    Messages:
    4,342
    Likes Received:
    334
    Location:
    Cikutra Yeuh
    Jadi bagusan yang mana nih? :hmm:
     
  20. iqbalsandira

    iqbalsandira Super Hero

    Joined:
    May 22, 2009
    Messages:
    4,719
    Likes Received:
    1,092
    Location:
    Makassar
    Hawkhost memang keren :gembira::gembira:
     

Share This Page