51 Responses

  1. Agus MU
    Agus MU Published |

    It’s very complete! You always write a complete tutorials. I like it. Thanks Justin…

    Reply
  2. Elliot
    Elliot Published |

    Is there a reason behind using endwhile + endif? why not use braces?

    Reply
  3. Billyboylindien
    Billyboylindien Published |

    Verry simple and complete doc.
    Merci beaucoup

    Reply
  4. Pierre K.
    Pierre K. Published |

    Hello Justin
    I have in fact read many articles about the loop, but yours is a model of precision and clarity. And I didn’t even know about the_title_attribute()…
    “Bravo !” as we say in french.

    Reply
  5. Hugo Baeta
    Hugo Baeta Published |

    Just wanted to commend you for writing such an amazing and precious article – oh, and written fantastically well!

    I’ve been playing with WordPress for a while (since 2.0), and I feel this article is perfect to rewind and review your coding – something worth doing!

    Thank you so much for this and for the great website.
    Cheers!

    Reply
  6. AC
    AC Published |

    Justin, thanks so much for the clarity of this document. I’ve only recently been trying out this powerful feature on my own, and I’ve put a little something together on my website in the Superior Software List page. I plan to do much more and this explanation will be my go to source for learning the details. Right now, I’ve just cut and pasted snips of code from your themes to put my page together and it’s working. But like i said, I’d like to do more.

    It’s so great how powerful wordpress is. Someone like me could not have put together a page as nice as I currently have 10 years ago without learning a lot of code and spending a lot of time on it. Thanks again.

    Reply
  7. Justin Tadlock on properly coding the WordPress Loop — WPCandy — WordPress Themes, Plugins, Tips, and Tricks
  8. Stefano
    Stefano Published |

    Hi Justin,
    great tutorial!
    It’s a “must read” for everyone that wants to write (and maybe distrubute) its own theme.

    Can I translate it to italian and post to my reader at WordPressMania.it obviously with linkback and so on… Still too many italians can’t read english…

    Stefano

    Reply
  9. BloggerSavvy
    BloggerSavvy Published |

    I like that you break this down, statement by statement. In particular, paying attention to detail is what makes this post more valuable. I’ve been able to use it to do a bit of tweaking. I’m not a programmer, but I can edit or change existing code, so this is a great “lesson”. This post is definitely “in the loop” :) Bookmarked!
    Thanks!

    Reply
  10. Tommy Day
    Tommy Day Published |

    Justin,

    Great article, I feel like I finally understand the loop now, when before I just felt that I was copying and pasting it every time.

    Thanks!

    Reply
  11. Richard
    Richard Published |

    Just like to say thanks for writing such an in depth, concise and easy to understand tutorial.
    I’m currently developing my first complete wordpress theme and have searched high and low for a proper breakdown on the loop. This has been the best explanation to date, just popped you into my RSS reader for future tutorials.

    Thanks

    Reply
  12. Weekend Links - Jan 29, 2009 | OMNINOGGIN
  13. Andrew
    Andrew Published |

    I really do think that many of the theme designers out there need to go to ‘WP Theme Coding 101′ to learn the basics about coding WP Themes.

    When helping people troubleshoot problems with their themes, I’m often pulling apart poor code that makes finding what I want difficult.

    Anyways, very good post, and I have bookmarked it for the time that I need to create a theme using very good coding standards.

    Reply
  14. WP Thoughts » Blog Archive » Coding the WordPress Loop - Part 1
  15. juliet
    juliet Published |

    can you show me a code that the output is the multiplication table..?
    from 1-12…
    hope you will grant my wish..tanx..!!!

    Reply
  16. Vitty Library
    Vitty Library Published |

    Thanks for the guide i had developed my first theme thanks a lot

    Reply
  17. WordPress Loop | Theme Heven
    WordPress Loop | Theme Heven at |
  18. Marlice
    Marlice Published |

    Hello Justin,

    just read a tutorial in the mag “Web designer” (http://www.webdesignermag.co.uk) on how to create a wordpress theme by Dan Philibin and Michael Castilla. They reference to your great article. Thank you very much for your great work and greetings from Germany :-)
    Marlice

    Reply
  19. Adi
    Adi Published |

    Is this about setting the single post template..

    Reply
  20. Kevin Lucius
    Kevin Lucius Published |

    Thanks a lot! I am just learning wordpress and php and this was very easy to follow and helped a lot. You really took time to explain every little bit. Thanks again

    Reply
  21. Alex
    Alex Published |

    Thanks for this tutorial. It’s well written and I appreciated that you offered an example to look at before diving in. Great job! This was really helpful.

    Reply
  22. kronos
    kronos Published |

    Yea, this is a real nice blog. Thanks you

    Reply
  23. Codelobster vs YouCMSAndBlog WYSIWYG Vs Aptana IDE for PHP, CSS, HTML, CMS (WordPress, Joomla, etc) « Sadhas Blog
  24. Никита
    Никита Published |

    I feel like I finally understand the loop now !!
    $)

    Reply
  25. WP: Loop de Loop « Pubmedia Commons
    WP: Loop de Loop « Pubmedia Commons at |
  26. Suzanne
    Suzanne Published |

    Justin I’m experimenting with a custom content type that would be similar to a Facebook status update or tweet – short blurbs I don’t want in my blog entry stream. I display these blurbs on their own index page using a standard loop, but unlike a normal index loop, I want comments to show under each entry so it looks similar to the Facebook wall. The comment form does NOT need to be there but I’d like the comments to show. Is this even possible within the loop?

    Reply
  27. WP: Loop de Loop | PubMedia Commons
  28. David A. Kennedy | 31 Resources for Powering a Website with Wordpress
  29. stephen
    stephen Published |

    This article helped me understand how to use the loop in a nice, clean fashion. I hate sloppy code and trying to learn from themes wasn’t getting me anywhere. Thanks so much!

    Reply
  30. Richard
    Richard Published |

    Hi Justin
    Thanks for your good explanation of the basic WP loop.

    I am presently struggling trying to find how to add ‘Permalink’ link at the end of WP3 loop in my theme anIMass!
    It is somewhere in here! But what & where & I have spent a lot of today trying to get it working?!

    <?php edit_post_link( __( 'Edit', 'anIMass' ), '| ', '' ); ?>
        	|
            
                  
            	<!-- .entry-utility -->
    	<!-- #post-## -->

    Oh the joy & pain of jolly old WordPress!

    Reply
  31. Lu
    Lu Published |

    Hi Justin. Thank you so much for this tutorial. I’ve hunted high and low for a simple tutorial that explains to me what The Loop is all about, what each bit is for, why it’s necessary and where it goes. You words are simple and concise. You can’t imagine how useful it has been! :)

    Reply
  32. Manoj
    Manoj Published |

    Thanks much Justin. On my main / home page, I have a pic and excerpt of the most recent post. I want to add a previous / next link and when user clicks just display the excerpt and picture of the previous / next post. Any tips on how to accomplish this. This is what I have in my loop currently:

    <a href="" rel="bookmark">
    	Category:  | Published by: | 
    <a href="" rel="bookmark" title="Permanent Link to ">Read the full post »
    Reply
  33. Designing a Wordpress Theme
    Designing a Wordpress Theme at |
  34. FC Barcelona
    FC Barcelona Published |

    Hi, its a good post, maybe you could also make a tutorial about using the loop twice on a page, what to avoid and the proper way of doing it?

    FC

    Reply
  35. Liam
    Liam Published |

    Hey, thanks for the tutorial, its done me wonders so far, I was wondering however if its possible to control an image within the entry content as well as the writing .. Im trying to position my post images to the left of the text, but for some reason I can’t seem to get it to work ? Any ideas anyone ?? Thanks very much !!

    Reply
  36. WordPress ile ilgili takip edilesi 10 muhteşem blog | Blog Wolkanca
  37. Tim
    Tim Published |

    Thanks! You really simplified the Codex.

    Reply
  38. Loren Helgeson
    Loren Helgeson Published |

    Wow! Back to basics, indeed. I’ve used most the standard loop a lot in my three years of working with Wordpress. Recently, I’ve been trying to breakdown the loop one item at a time, since I do a lot of custom themes and I’m always trying to make each new theme better than the last.

    I was never got a proper indoctrination into the importance of a clean loop. So, thank you for laying this out in as complete a detail as you have.

    Reply
  39. drwain
    drwain Published |

    It’s been a few years since you posted these instructions but for a web builder incorporating WordPress for the first time this is exactly what I was looking for.
    Thank you so much for you precise instructions and code samples.
    I had searched the web for a while and only your instructions gave me the look I was after.
    Cheers :)

    Reply
  40. William Mosley
    William Mosley Published |

    Thank you for the post. I found it very useful. I was also looking to have more control over the styling of the loop and posts in it. Your code provides that.

    Reply
  41. Gaurav Ramesh
    Gaurav Ramesh Published |

    Hey Justin.. Thanks for such nice articles. I’ve just started with Wordpress development and I’m lucky to have found your blog right in the beginning. This article and “sidebar in wordpress” are awesome so far.

    Reply
  42. Create Your WordPress Loop In 5 Easy Steps | Simplified Scripting
  43. deWEBlopers – Cómo crear un loop WordPress perfecto
  44. Cómo crear un loop WordPress perfecto | CURSO WORDPRESS
  45. Bernard
    Bernard Published |

    Probably a perfect tutorial. Thanks a lot.

    Reply
    1. adi
      adi Published |

      Very nice tutorial, I finally understand The Loop jobs in no time. :)

      Reply
  46. Ibrahim Vatih
    Ibrahim Vatih Published |

    I think when someone write a complete tutorial (and details), i know that must be well designed. And you always do that, awesome!

    Thanks for anything in your site, Justin :D

    Reply
  47. Step by Step Guide to WordPress Post Formats | Shade Tree Sites
  48. 31 Resources for Powering a Website with WordPress | David A. Kennedy

Leave a Reply

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/Web site in attribution.

Please use your real name or a pseudonym (i.e., pen name, alias, nom de plume) when commenting. If you add your site name, company name, or something completely random, I'll likely change it to whatever I want.

css.php