doin’ da loop with da wordprezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · doin’ da...

65
Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Upload: others

Post on 19-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Doin’ da Loopwith da WordPrez

Gary Barberradharc.com.au

manwithnoblog.com

Page 2: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

I’m Assuming• You know what WordPress is and you have used it.

Page 3: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

I’m Assuming• You know what WordPress is and you have used it.

• You know that you can use plugins and widgets

Page 4: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

I’m Assuming• You know what WordPress is and you have used it.

• You know that you can use plugins and widgets

• Your blog is not on wordpress.com

Page 5: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

I’m Assuming• You know what WordPress is and you have used it.

• You know that you can use plugins and widgets

• Your blog is not on wordpress.com

• You know what PHP is

Page 6: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

I’m Assuming• You know what WordPress is and you have used it.

• You know that you can use plugins and widgets

• Your blog is not on wordpress.com

• You know what PHP is

• You are not happy coding

Page 7: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

I’m Assuming• You know what WordPress is and you have used it.

• You know that you can use plugins and widgets

• Your blog is not on wordpress.com

• You know what PHP is

• You are not happy coding

• You have never pulled the templates apart

Page 8: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

...Boring...So Get on With It....

Page 9: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

What is the Loop• It’s the core of WordPress

Page 10: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

What is the Loop• It’s the core of WordPress

• It’s a heap of PHP code over different files that works together

Page 11: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

What is the Loop• It’s the core of WordPress

• It’s a heap of PHP code over different files that works together

• Lets you display your posts, comments and the rest of your blog

Page 12: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com
Page 13: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

So where is the Loop• WordPress uses one

central control point

Page 14: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

So where is the Loop• WordPress uses one

central control point

• All requests go via this file - index.php

Page 15: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

So where is the Loop• WordPress uses one

central control point

• All requests go via this file - index.php

• It’s your themes central control

Page 16: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

So where is the Loop• WordPress uses one

central control point

• All requests go via this file - index.php

• It’s your themes central control

• Remove it you get the default theme

Page 17: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

So where is the Loop• WordPress uses one

central control point

• All requests go via the file - index.php

• It’s your themes central control

• Remove it you get the default theme

• Remove that ....

Page 18: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com
Page 19: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

So where is the Loop• WordPress uses one

central control point

• All requests go via the file - index.php

• It’s your themes central control

• Remove it you get the default theme

• Remove that and you get nothing

Page 20: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

How does it work The Loop is really very basic

<?php get_header(); ?>

<?php if (have_posts()) ?> <?php while (have_posts()) ?> <?php the_post();?><?php the_content();?> <?php endwhile; ?>

<?php endif; ?>

<?php get_sidebar();?><?php get_footer(); ?>

Page 21: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

How does it work The Loop is really very basic

<?php get_header(); ?>

<?php if (have_posts()) ?> <?php while (have_posts()) ?> <?php the_post();?><?php the_content();?> <?php endwhile; ?>

<?php endif; ?>

<?php get_sidebar();?><?php get_footer(); ?>

Show the Page Header

Page 22: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

How does it work The Loop is really very basic

Show the Page Header

Do the Loop!

<?php get_header(); ?>

<?php if (have_posts()) ?> <?php while (have_posts()) ?> <?php the_post();?><?php the_content();?> <?php endwhile; ?>

<?php endif; ?>

<?php get_sidebar();?><?php get_footer(); ?>

Page 23: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

How does it work The Loop is really very basic

<?php get_header(); ?>

<?php if (have_posts()) ?> <?php while (have_posts()) ?> <?php the_post();?><?php the_content();?> <?php endwhile; ?>

<?php endif; ?>

<?php get_sidebar();?><?php get_footer(); ?>

Show the Page Header

Do the Loop!

Show the Page Footer & Side Bar

Page 24: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

In Detail <?php if (have_posts()) ?>

<?php while (have_posts()) ?>

<?php the_post();?>

<?php the_content();?>

<?php endwhile; ?>

<?php endif; ?>

• Section One - checks information

Page 25: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com
Page 26: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com
Page 27: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com
Page 28: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

In Detail <?php if (have_posts()) ?>

<?php while (have_posts()) ?>

<?php the_post();?>

<?php the_content();?>

<?php endwhile; ?>

<?php endif; ?>

• Section One - checks information

• Section Two - gets the posts, and more information

Page 29: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com
Page 30: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

In Detail <?php if (have_posts()) ?>

<?php while (have_posts()) ?>

<?php the_post();?>

<?php the_content();?>

<?php endwhile; ?>

<?php endif; ?>

• Section One - checks information

• Section Two - gets the posts, and more information

• Section Three - displays the posts and information

Page 31: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com
Page 32: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

And a Little Closer <?php if (have_posts()) ?>

<?php while (have_posts()) ?>

<?php the_post();?>

<?php the_content();?>

<?php endwhile; ?>

<?php endif; ?>

• Check that there are posts

Page 33: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

And a Little Closer <?php if (have_posts()) ?>

<?php while (have_posts()) ?>

<?php the_post();?>

<?php the_content();?>

<?php endwhile; ?>

<?php endif; ?>

• Get information on the post along with secondary information like:

Post TitlePublication DateAuthorCategories

Page 34: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

And a Little Closer <?php if (have_posts()) ?>

<?php while (have_posts()) ?>

<?php the_post();?>

<?php the_content();?>

<?php endwhile; ?>

<?php endif; ?>

• Then WordPress displays the post with all its formatting information on your blog

Page 35: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

And a Little Closer <?php if (have_posts()) ?>

<?php while (have_posts()) ?>

<?php the_post();?>

<?php the_content();?>

<?php endwhile; ?>

<?php endif; ?>

• Then WordPress goes and checks for more posts and we start again.

Page 36: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Some Examples - Default<?php get_header(); ?><div id="content" class="narrowcolumn"><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to

<?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> </div><?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div><?php get_sidebar(); ?><?php get_footer(); ?>

Page 37: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Some Examples - Default<?php get_header(); ?><div id="content" class="narrowcolumn"><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to

<?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> </div><?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div><?php get_sidebar(); ?><?php get_footer(); ?>

Page 38: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Some Examples - Default<?php get_header(); ?><div id="content" class="narrowcolumn"><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to

<?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> </div><?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div><?php get_sidebar(); ?><?php get_footer(); ?>

Page 39: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Some Examples - Default<?php get_header(); ?><div id="content" class="narrowcolumn"><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to

<?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> </div><?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div><?php get_sidebar(); ?><?php get_footer(); ?>

Page 40: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Some Examples - Default<?php get_header(); ?><div id="content" class="narrowcolumn"><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to

<?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> </div><?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div><?php get_sidebar(); ?><?php get_footer(); ?>

Page 41: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Some Examples - Default<?php get_header(); ?><div id="content" class="narrowcolumn"><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to

<?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> </div><?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div><?php get_sidebar(); ?><?php get_footer(); ?>

Page 42: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Some Examples - Default<?php get_header(); ?><div id="content" class="narrowcolumn"><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to

<?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> </div><?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div><?php get_sidebar(); ?><?php get_footer(); ?>

Page 43: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Some Examples - Default<?php get_header(); ?><div id="content" class="narrowcolumn"><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to

<?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> </div><?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div><?php get_sidebar(); ?><?php get_footer(); ?>

Page 44: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Items to Note<?php get_header(); ?><div id="content" class="narrowcolumn"><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to

<?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> </div><?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div><?php get_sidebar(); ?><?php get_footer(); ?>

Page 45: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Items to Note<?php get_header(); ?><div id="content" class="narrowcolumn"><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to

<?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> </div><?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div><?php get_sidebar(); ?><?php get_footer(); ?>

Page 46: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Items to Note<?php get_header(); ?><div id="content" class="narrowcolumn"><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to

<?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> </div><?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div><?php get_sidebar(); ?><?php get_footer(); ?>

Page 47: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Items to Note<?php get_header(); ?><div id="content" class="narrowcolumn"><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to

<?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> </div><?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div><?php get_sidebar(); ?><?php get_footer(); ?>

Page 48: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Items to Note<?php get_header(); ?><div id="content" class="narrowcolumn"><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to

<?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> </div><?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div><?php get_sidebar(); ?><?php get_footer(); ?>

Page 49: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Items to Note<?php get_header(); ?><div id="content" class="narrowcolumn"><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to

<?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> </div><?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div><?php get_sidebar(); ?><?php get_footer(); ?>

Page 50: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Items to Note<?php get_header(); ?><div id="content" class="narrowcolumn"><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to

<?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> </div><?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div><?php get_sidebar(); ?><?php get_footer(); ?>

Page 51: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Items to Note<?php get_header(); ?><div id="content" class="narrowcolumn"><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to

<?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> </div><?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div><?php get_sidebar(); ?><?php get_footer(); ?>

Page 52: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Life After the Loop<?php get_header(); ?><div id="content" class="narrowcolumn"><?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <div class="post" id="post-<?php the_ID(); ?>"> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to

<?php the_title(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('Read the rest of this entry &raquo;'); ?> </div> <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?></p> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('&laquo; Previous Entries') ?></div> <div class="alignright"><?php previous_posts_link('Next Entries &raquo;') ?></div> </div><?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?><?php endif; ?></div><?php get_sidebar(); ?><?php get_footer(); ?>

Page 53: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

...So when does it get Interesting...

Page 54: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

The Loop is Breeding• The Loop is all through

WordPress

Page 55: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

The Loop is Breeding• The Loop is all through

WordPress

• In the Archive Template

Page 56: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

The Loop is Breeding• The Loop is all through

WordPress

• In the Archive Template

• In the Search Template

Page 57: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

The Loop is Breeding• The Loop is all through

WordPress

• In the Archive Template

• In the Search Template

• It’s even used for the generation of the comments

Page 58: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Customise the Loop• Change Archive and Search pages to display excerpt

Page 59: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Customise the Loop• Change Archive and Search pages to display excerpt

• Customise the CSS for different times, dates, categories, authors days of the week

Page 60: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Customise the Loop• Change Archive and Search pages to display excerpt

• Customise the CSS for different times, dates, categories, authors days of the week

• Change your home page to a static one

Page 61: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Customise the Loop• Change Archive and Search pages to display excerpt

• Customise the CSS for different times, dates, categories, authors days of the week

• Change your home page to a static one

• Place items between blog posts

Page 62: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Customise the Loop• Change Archive and Search pages to display excerpt

• Customise the CSS for different times, dates, categories, authors days of the week

• Change your home page to a static one

• Place items between blog posts

• Add a Lemon

Page 63: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Customise the Loop• Change Archive and Search pages to display excerpt

• Customise the CSS for different times, dates, categories, authors days of the week

• Change your home page to a static one

• Place items between blog posts

• Add a Lemon

• But check for Plugins or Widgets first

Page 64: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Customising Demo

Page 65: Doin’ da Loop with da WordPrezmanwithnoblog.com/presentations/the-loop/the-loop.pdf · Doin’ da Loop with da WordPrez Gary Barber radharc.com.au manwithnoblog.com

Thankyou• wordpress.org• mattread.com• ifelse.co.uk• Pennance368• fensterbme • fotopeet• gerardvschip• Niklas

• drpritch• pierre pouliquin

Distributed under Creative Commons License

Gary [email protected]

radharc.com.aumanwithnoblog.com