Perth barcamp 2007 – WordPress loop – Gary Barber


Gary Barber is the Man with no blog and his slides are on slideshare, Doin’ da Loop with da WordPrez

  • He promised not to be too technical
  • Was going to do it all in lolcat speak
  • Presuming know plugins, widgets, can alter source code of WP blog, know what php is, not happy coding, not pulled template apart
  • What is the loop
    • Core of WordPress
    • PHP code distributed thoughout the system
    • Lets you display comments, posts, rest of blog
    • Loop is the single central control point
    • index.php
    • remove index.php – goes back to default theme. Remove default theme after that, then deadibones.

    How does the Loop works:

    • in index.php – middle bit btw header and end
    • 1. If have posts
    • 2. Gets the posts plus post meta data
    • 3. Gets it in the right format
    • 4. Does it over and over.

    Looking at default template

    • If want to make changes to happen after every post – then put it just after the <div> and before the <endwhile>
    • Look at where you add title and permalink

    Then in template div class align..

  • The loop is all through wordpress
  • Archive, comments
  • What can you do with the loop?
    • Customise the loop -display excerpt only
    • Customise CSS for different dates, times, catergories, authors, days of the week (Eg. Things written Tuesday have a blue background)
    • Change home page to static one
    • Can place items between blog posts – put it before the end while

    Before start hacking the code

    • Backup
    • Check to see whether there is a plugin or widget that does the same thing

What do you think? Let us know.