i cant think A blog belong to Mohammad Azwan bin Ali. Most of his writings are about his real life story, ideas, thoughts, moderate political views, computer, programming, tips & tricks, particularly in Linux…. and of course it includes some random unspecified crappy stuffs too! Don't forget to check Movies and Junkyard pages out!
note: most of entries is not suitable for faint hearted person or anybody with iq below 100.

how to divide latest post and previous post in theme

i been testing something new here while playing with wordpress codes. alright do you see my theme? the latest post and others 4 entry are divided right? the 1st post (latest) were shown at the top. while others 4 entry in column form. this is good in order to make your visitor focus on your latest post instead of older one.

note that this is for wordpress theme only! but that doesnt mean other blog engine can't use this concept. but of course in different way

here is the quickest and dirties trick to do that.

first, declare a variable named

$divider

before

<?php while (have_posts()) : the_post(); ?>

if (is_home() && !is_paged()) { // set for frontpage only
$divider = 1; //set the variable
while (have_posts()) : the_post();
if ($divider ==1) { echo '<div class="top">;' ?>
...all standard wp codes goes here...
</div>
< ?php } // don't forget to close it
else { echo '<div class="column">'; ?>
...all standard wp codes goes here...
</div>
<?php } // close it again ?>
<?php $divider++; endwhile; //make sure you increase the valud of divider ?>

it will look something like this.got the idea? if you are a person who like to test for something new and "rajin", you can try to make dynamic alignment for each entry. such as

if ($divider == 1) { post want will be at the top, with background grey, bigger font }
if ($divider == 2 or $divider == 3) { post with be combined in column smaller font }

and so on.. just do experiments with it.

oh ya, this is my new layout. ya i know, it's plain, but i like it :D p/s: this is not K2 mod anymore. i rebuild it based on k2, which mean, i try to make it work look like K2 esspecially the ajax comment :p

since there where to many tutorial out there and i have plenty of time, i decided to learn
ajax deeper.now i'm working on my own livesearch.

till then, happy learning to you too!


9 Comments

wah2..dasat hang sekarang..teruskan :D..[thumb]

Posted by Bat on 7 December 2006 @ 2am

haha. code punya code tak berapa jadi. aku dah ubahsuai sket jadi superb.

Posted by azraai on 7 December 2006 @ 3am

[...] Yeah, the modification of my “Blue Way” theme just a few mile a way from the end. Now I’m going yo rewrite my comment template. By the way, I’m going to correct novatech latest post trick; Here is the corrected code. [...]

Posted by Genius! Playground » Blue Way 2.0 Beta on 7 December 2006 @ 3am

yaya, code diatas tidak di cek ada error
it just my way to shown a "concept" ehehe
tq bat, akan ku teruskan. sbb bila dah start main ngan wordpress ni, memang takleh nak berenti [lolx]

Posted by novatech on 7 December 2006 @ 4pm

aku tgk idea hg ja..tapi tak test lagi..weh aku nak buat theme satu lagi la..untuk personal use..huhu..

Posted by Bat on 7 December 2006 @ 5pm

lagi banyak code, lagi mantap blog kita... :)

Posted by aman on 7 December 2006 @ 8pm

you're God... Haha!

Posted by dinswok on 8 December 2006 @ 8pm

aku buat ngan several template... senang sket..

Posted by ikram_zidane on 11 December 2006 @ 3am

Nice.. tau tak mana nak cari themes buatan orang malaysia yang lawa lawa ?

Posted by Pertapa on 26 January 2007 @ 3am