Memecah Sidebar

Oke, kita lanjutkan kegiatan memecah belah kita hehehe.. Jika sebelumnya kita telah memisahkan header dan footer, tapi bagian konten dan sidebar kan masih menyatu tuh di index.php. Nah, sudah saatnya kita ceraikan mereka hahahaha….

Baik, langsung aja buka index.php lalu cari kode yang membangun sidebar. Kalau anda mengikuti pelajaran themes ini dari awal, harusnya kode sidebarnya seperti ini:

     <div id="sidebar">
    <?php if ( is_active_sidebar( 'sidebar-lebar' ) ) : ?>  
        <div id="lebar">
      <ul>          
            <?php dynamic_sidebar( 'sidebar-lebar' ); ?>    
      </ul>
        </div>
    <?php endif; ?>    
        <div id="kiri">
      <ul>
            <?php if ( ! dynamic_sidebar( 'sidebar-kiri' ) ) : ?>
      <li id="search" class="widget-container widget_search">
        <?php get_search_form(); ?>
      </li>

      <li id="archives" class="widget-container">
        <h3 class="widget-title">Arsip</h3>
        <ul>
          <?php wp_get_archives( 'type=monthly' ); ?>
        </ul>
      </li>
      <?php endif; ?>
      </ul>
        </div>
        <div id="kanan">
      <ul>
            <?php if ( ! dynamic_sidebar( 'sidebar-kanan' ) ) : ?>
      <li id="meta" class="widget-container">
        <h3 class="widget-title">Meta</h3>
        <ul>
          <?php wp_register(); ?>
          <li><?php wp_loginout(); ?></li>
          <?php wp_meta(); ?>
        </ul>
      </li>
      <?php endif; ?>
      </ul>
        </div>
      </div>

Sebagaimana pelajaran yang lalu cut code ini lalu paste ke file baru dengan nama sidebar.php. Nah, sebagai ganti kode yang sudah hilang ini, kita pasang kode untuk memanggil sidebar yaitu:

<?php get_sidebar(); ?>

Dan inilah hasil akhir index.php yang sudah sendirian hehehe….

<?php get_header(); ?>
     <div id="maincontent">
    <div id="content">
    
    <script type="text/javascript">
    jQuery(function() {
      jQuery(".mygallery").jCarouselLite({
        btnNext: ".nextb",
        btnPrev: ".prevb",
        visible: 1,
        speed: 2000,
        auto: 3000,
        easing: "backout"
      });
    });
    </script>

    <div id="slidearea">

      <div id="gallerycover">
        <div class="mygallery">

        <ul>
        <?php 
          $my_query = new WP_Query('showposts=5');
          while ($my_query->have_posts()) : $my_query->the_post();
          $do_not_duplicate = $post->ID;
        ?>
        <li>
          <div class="mytext">
            <a href="<?php the_permalink() ?>">
             <?php 
              if ( has_post_thumbnail() ) {
                the_post_thumbnail();
              } else {
                echo '<img src="'.get_bloginfo('template_url').'/images/thumbnail.png" alt="'.get_the_title().'" class="wp-post-image"/>';
              }
             ?>
            </a>
            <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
            <p><?php the_content_rss('more_link_text', TRUE, '', 30); ?> 
            <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">read more..</a></p>
            
            <div class="slimeta">
            <a href="#" class="prevb">&laquo; Previous</a><a href="#" class="nextb">Next &raquo;</a>
            </div>
          </div>     
        </li>
          <?php endwhile; ?>
        </ul>

        <div class="clear"></div>  
          
        </div>
      </div>

    </div>
       <?php if ( have_posts() ) : ?>
      <?php while ( have_posts() ) : the_post(); ?>
      <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
        <?php
        if (!is_single()) {
          if ( has_post_thumbnail() ) {
            the_post_thumbnail();
          } else {
            echo '<img src="'.get_bloginfo('template_url').'/images/thumbnail.png" alt="'.get_the_title().'" class="wp-post-image"/>';
          }
        }
        ?>
        <h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
        <p><?php if (is_single()) { the_content(); } else { the_excerpt(); } ?></p>
        <div id="postmeta">Publish on <?php the_time('F jS, Y'); ?> under <?php the_category(', '); ?> by <?php the_author(); ?> | 
        <?php comments_popup_link('No Comments &raquo;', '1 Comment &raquo;', '% Comments &raquo;'); ?> 
        <?php edit_post_link('Edit','| ',''); ?></div>
      </div>
      <?php comments_template(); ?>
      <?php endwhile;?>
       <?php endif;?>
    </div>
    <?php get_sidebar(); ?>
     </div>
<?php get_footer(); ?>

Mudah-mudahan cukup dimengerti. Intinya cuma memindah kode-kode di index.php ke file yang baru aja sehingga ke depan akan lebih mudah pengelolaannya.

Berikutnya adalah mentransformasi file index.php ini menjadi single.php, page.php dan archive.php serta category.php. Ya, kita akan banyak bekerja dengan file-file standart WordPress nantinya. Keep watching!!

Dicari dengan kata kunci:

coding div kiri kanan php,memecah index php,cara memindahkan sidebar dari kiri ke kanan diwordpress,cara memindahkan sidebar dari kiri ke kanan dengan php,memindah side bar wordpress,cara memindahkan kategori ke kiri pada wordpress,memisahkan content dengan sidebar,memisahkan sidebar dengan konten,memcah file index pada php kuliah net,memisahkan index php

20 thoughts on “Memecah Sidebar

  1. qo2

    oalah mas mas … saya sampe puyeng qo si sidebar jadi menyatu di indeks posisi nya .. ternyata hiks hiks kena kerjain .. haha …

    lanjut ke tahap memecah sidebar dulu mas .. nanti comment lagi 😀

  2. tas artis

    saya belum coba, tapi data ini akan saya simpan dan nanti saya buka lagi kalau sudah mengerti sedikit-sedikit. Ibarat perpustakaan, kalau butuh tinggal cari. Semua hal juga awalnya begitu…

  3. NGalor Ngidul

    Gan…
    Bikin Tutorial lagi donk……
    Ane lagi coba2 WP neh…
    Klo misalnya kita ingin di homepage ada 2 sidebar, tapi dihalaman posting cuma satu sidebar gimana caranya tuh???
    Bisa Bikin tutorialnya gak???
    Thanks sebelumnya…
    ^_^

  4. ediprasetiyo

    tanya gan kok pas ane masukin widget text or html gak muncul cuma ada tombol delete sama close jadi fom buat textnya gak ada ane bingung gimana masukin textnya kalo gak muncul mohon pencerahanya thank’s

  5. handri

    mas,,, bisa sekalian di tampilin gak hasil dari langkah2 itu,,,,
    ,,puyeng mas lw cman di bayangin aja

    trima kasih,,

  6. furniture jepara

    Salam.
    Mas saya mau pindah sidebar kanan jadi ke kiri, tapi itu di gambar kayaknya punya blogspot ya ? saya pake premium wordpress. ini sampek botak rambutku mikir kodenya. saya coba terus tetep gagal cuman udah ada perubahan, tinggal di poles dikit kodenya selese, cuman ini udah mentok 😀

    Mohon bantuanya..
    email : armandoiswahyudi@yahoo.com

  7. wisata karimunjawa

    selamat siang mas……. mau minta bantuan nih semoga aja ada yang tahu. untuk widget sidbar saya tidak menyatu pada judul widget yang disediakan. nah apakah ada kode untukmenyatukan judul tersebut mas

  8. look at here now

    I simply want to tell you that I am just all new to blogs and seriously enjoyed your web page. Almost certainly I’m going to bookmark your blog . You absolutely have wonderful articles. Many thanks for revealing your web-site.

  9. Daren Lundman

    I loved as much as you will receive carried out right here. The sketch is attractive, your authored material stylish. nonetheless, you command get bought an edginess over that you wish be delivering the following. unwell unquestionably come further formerly again as exactly the same nearly very often inside case you shield this increase.

  10. xbox live codes

    But 37 individuals, many in your circle of good friends, have previously preferred this state, and you simply style of appear to be a douche if you happen to don’t, as well

  11. Hipolito M. Wiseman

    Zune and iPod: Most people compare the Zune to the Touch, but after seeing how slim and surprisingly small and light it is, I consider it to be a rather unique hybrid that combines qualities of both the Touch and the Nano. It’s very colorful and lovely OLED screen is slightly smaller than the touch screen, but the player itself feels quite a bit smaller and lighter. It weighs about 2/3 as much, and is noticeably smaller in width and height, while being just a hair thicker.

  12. Santos Mccarty

    I was recommended this website by my cousin. I’m not sure whether this post is written by him as nobody else know such detailed about my problem. You are wonderful! Thanks!

  13. Shaquana Leckband

    Hi, Neat post. There is a problem with your website in internet explorer, would test this… IE still is the market leader and a huge portion of people will miss your magnificent writing due to this problem.

  14. Lang Fasciano

    Its like you read my mind! You appear to know so much about this, like you wrote the book in it or something. I think that you can do with a few pics to drive the message home a little bit, but instead of that, this is great blog. A great read. I’ll definitely be back.

  15. Andrew A. Sailer

    I’ll gear this review to 2 types of people: current Zune owners who are considering an upgrade, and people trying to decide between a Zune and an iPod. (There are other players worth considering out there, like the Sony Walkman X, but I hope this gives you enough info to make an informed decision of the Zune vs players other than the iPod line as well.)

  16. Yetta Nicolia

    Hello There. I found your weblog using msn. That is a really well written article. I will be sure to bookmark it and return to learn extra of your helpful info. Thanks for the post. I will definitely return.

Comments are closed.