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!

8 Comments

  1. Posted December 7, 2006 at 2:59 am | Permalink

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

  2. Posted December 7, 2006 at 3:35 am | Permalink

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

  3. Posted December 7, 2006 at 4:38 pm | Permalink

    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]

  4. Posted December 7, 2006 at 5:20 pm | Permalink

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

  5. Posted December 7, 2006 at 8:31 pm | Permalink

    lagi banyak code, lagi mantap blog kita… :)

  6. Posted December 8, 2006 at 8:51 pm | Permalink

    you’re God… Haha!

  7. Posted December 11, 2006 at 3:03 am | Permalink

    aku buat ngan several template… senang sket..

  8. Posted January 26, 2007 at 3:44 am | Permalink

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

One Trackback

  1. By Genius! Playground » Blue Way 2.0 Beta on December 7, 2006 at 3:53 am

    [...] 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. [...]