Friday, July 15, 2011

Belajar Membuat Theme WordPress [P7]

Selamat malam semuanye… pa kabar nih?? bertemu lagi dengan angga a.k.a anggamovic, setelah kemaren kita buat file single.php sekarang kita akan membahas page.php

Sebenernye sama aja dengan single.php cuma page.php ini akan didipake sebagai default page yang kita buat.
Sekarang kita buka lagi file single.php nya.. dan copy semua source yang ada, copas ke file page.php
Maka file page.php akan menjadi seperti ini
<?php get_header()?>
<section id=”content”><!– #content –>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<article>
<h2><a href=”<?php the_permalink() ?>” ><?php the_title(); ?></a></h2>
<p><img src=”<?php bloginfo(‘template_directory’); ?>/images/orangebutterfly.png” alt=”” />
<?php the_content(‘Read more &raquo;’); ?></p>
</article>
<?php comments_template(); ?>
<?php endwhile; ?>
<?php endif; ?>
</section><!– end of #content –>
<?php get_sidebar(); ?><?php get_footer();?>
Ada satu lagi trik di file page.php ini. ane nemu trik ini setelah beberapa waktu lalu ane mau buat page galery di blog ane, tapi rasanya canggung klo pake template page bawaan tema. makanya ane cari sumber lain dan ga jauh jauh.. ketemunye di instalan wordpress juga, tepatnye di tema bawaan wordpress.. nah hal yang perlu kalian tambahkan untuk membuat page yang kalian ingin kan dan pastinya beda dari page.php yang ada. silakan kalian modifikasi sebagus mungkin file page.php nya. setelah itu save as, ubah namanya terserah kalian, disini saya kasih contoh galery.php nah setelah itu kalian tambah kan code ini tepat di atas
<?php get_header();?>

Berikut codenya
<?php /*
Template Name: Galery
*/ ?>
Nah jadinya seperti ini

<?php /*
Template Name: Galery
*/ ?>

<?php get_header()?>
<section id=”content”><!– #content –>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<article>
<h2><a href=”<?php the_permalink() ?>” ><?php the_title(); ?></a></h2>
<p><img src=”<?php bloginfo(‘template_directory’); ?>/images/orangebutterfly.png” alt=”” />
<?php the_content(‘Read more &raquo;’); ?></p>
</article>
<?php comments_template(); ?>
<?php endwhile; ?>
<?php endif; ?>
</section><!– end of #content –>
<?php get_sidebar(); ?><?php get_footer();?>

Oke untuk kostumasinya saya akan tampilkan jika tutorial ini sudah selesai dan tema hasil buatan kita ..
So have a nice day and nice day
Dont Forget To Join Forum BinusHacker :)
http://forum.binushacker.net

0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Affiliate Network Reviews