• Like
  • Save

Loading…

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

Like this presentation? Why not share!

WordCamp Vegas 2010

on

  • 1,244 views

My presentation from WordCamp Vegas 2010.

My presentation from WordCamp Vegas 2010.

Statistics

Views

Total Views
1,244
Views on SlideShare
1,103
Embed Views
141

Actions

Likes
1
Downloads
4
Comments
0

2 Embeds 141

http://jakespurlock.com 140
http://207.46.192.232 1

Accessibility

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />
  • <br />

WordCamp Vegas 2010 WordCamp Vegas 2010 Presentation Transcript

  • THE LOOP JAKE SPURLOCK @WHYISJAKE JAKESPURLOCK.COM
  • #ISURVIVEDTHEDRIVEHOME
  • DEVELOPERS IN THE HOUSE?
  • OVERVIEW INTRODUCE THE LOOP BASIC TEMPLATE TAGS CUSTOM QUERIES MULTIPLE LOOPS PAGE CUSTOM POST TYPES
  • GET STARTED... WHY NOT JUST LOOK AT CODE EH?
  • SIMPLEST INDEX PAGE <?PHP IF (HAVE_POSTS()) : WHILE (HAVE_POSTS()) : THE_POST(); THE_CONTENT(); ENDWHILE; ENDIF; ?>
  • TEMPLATE TAGS .:THE BREAD AND BUTTER OF THEME DESIGNERS:.
  • TEMPLATE TAGS THE_CONTENT() THE_META(); THE_TITLE() THE_ID() THE_PERMALINK() THE_POST_THUMBNAIL() THE_CATEGORY() THE_AUTHOR() THE_TAGS() THE_SHORTLINK() THE_DATE() EDIT_POST_LINK() CODEX.WORDPRESS.ORG/TEMPLATE_TAGS THE_EXCERPT()
  • CUSTOM QUERIES
  • QUERY_POSTS VS. GET_POSTS
  • QUERY_POSTS WHEN YOU WANT TO CHANGE THE MAIN LOOP EXCLUDE CATEGORIES FROM MAIN LOOP SHOW POSTS FROM ONLY ONE CATEGORY.
  • IMPORTANT NOTE THE QUERY_POSTS FUNCTION IS INTENDED TO BE USED TO MODIFY THE MAIN PAGE LOOP ONLY. IT IS NOT INTENDED AS A MEANS TO CREATE SECONDARY LOOPS ON THE PAGE. IF YOU WANT TO CREATE SEPARATE LOOPS OUTSIDE OF THE MAIN ONE, YOU SHOULD USE GET_POSTS() INSTEAD. USE OF QUERY_POSTS ON LOOPS OTHER THAN THE MAIN ONE CAN RESULT IN YOUR MAIN LOOP BECOMING INCORRECT AND POSSIBLY DISPLAYING THINGS THAT YOU WERE NOT EXPECTING. THE QUERY_POSTS FUNCTION OVERRIDES AND REPLACES THE MAIN QUERY FOR THE PAGE. TO SAVE YOUR SANITY, DO NOT USE IT FOR ANY OTHER PURPOSE.
  • <?php //The
Query query_posts('posts_per_page=5'); //The
Loop if
(
have_posts()
)
:
while
(
have_posts()
)
:
 the_post(); 
.. endwhile;
else: 
.. endif; //Reset
Query wp_reset_query(); ?>
  • CUSTOM POST TYPES?
  • QUERY_POSTS WITH CUSTOM POST TYPES QUERY_POSTS( 'POST_TYPE=NAME 0F POST TYPE'); QUERY_POSTS(ARRAY('POST_TYPE' => ARRAY('POST', 'MOVIES')));
  • PLUGIN? ADD_FILTER( 'PRE_GET_POSTS', 'MY_GET_POSTS' ); FUNCTION MY_GET_POSTS( $QUERY ) { ! IF ( IS_HOME() && FALSE == $QUERY- >QUERY_VARS['SUPPRESS_FILTERS'] ) ! ! $QUERY->SET( 'POST_TYPE', ARRAY( 'POST', 'PAGE', 'ALBUM', 'MOVIE', 'QUOTE', 'ATTACHMENT' ) ); ! RETURN $QUERY; } VIA
JUSTIN
TADLOCK
  • THE LOOP JAKE SPURLOCK @WHYISJAKE JAKESPURLOCK.COM