The Blog Herald logo

  • News
  • Features
  • Guides
  • Editorial
  • Interviews
  • Blog Tips
  • More
    • General
    • Blog Conferences
    • Contact Us
    • Terms & Privacy
    • Disclaimer
harika bir kıvama gelmeye başlamıştır onun porno kalçaları ve teni tam hayalini kurduğu kadın porno resimleri profiline uyduğunu anlayan genç adam kuzenlerine porno gif geldiğinde onun odasına gelerek kirli sepetinden porn birkaç kullanılmış don alarak sikini sürterek fantezi sex resim yaşamak ister odaya gelir ve kullanılmış külotuna porno sikini değdirdiği sırada içeri kuzeni gelir onun sex hikayeleri bir şeyler karıştırdığını anlayan kız hemen sepetin porno izle oradaki donunun dışarıda olduğunu görür

A WordPress Developer’s Best Friend

May 31, 2007 by Nathan Rice

Have you ever wondered how some WordPress blogs have all those little sections of content? You know, one list that has the 5 most recent stories in a specific category. Another section has a “aside” story. Yet another list called “news” that has a list of stories, but they never get to the main part of the homepage.

This is sometimes known as a “magazine” or “newspaper” style homepage, and although it is a bit complicated to create, the common denominator is a handy little loop condition called “query_posts“.

I first discovered it, of course, by client request. A client wanted a homepage to have a “sideblog” in one of the sidebars that displayed the title and excerpt from all the posts he put in the “sideblog” category.

In fact, the same strategy is employed here on The Blog Herald. See how in the sidebar, directly under the ads, there is a list of news? Where does that come from? For that matter, where does the feature news on the left side come from?

query_posts — that’s where.

query_posts is a way to qualify the loop. It allows you to tell the look which articles to fetch. And it’s pretty straightforward too. Here are some common uses:

<?php query_posts(‘cat=1’); ?>

Place that little blurb before your loop, and it will only display stories in category 1 (that would be the category ID, not the name).

<?php query_posts(‘showposts=3’); ?>

This will output only 3 stories.

<?php query_posts(‘category_name=Staff Home’); ?>

This one limits the loop to only output stories in the “Staff Home” category (this time, it uses the name, not the category ID).

And the possibilities are nearly endless.

So if you ever wanted to know how the big boys make their themes, there you go. Yes, it’s a bit anticlimactic, but a neat trick nevertheless. Over the next few weeks, I’ll be sharing some other tricks like this to make your WordPress theme super cool using query_posts. For more information on the query_posts qualifier, check out the codex. Lots of cool tips there!

Happy coding!

Filed Under: Features, Guides Tagged With: Blog Design

Like & Share this Article

Comments

  1. game machine says

    June 7, 2007 at 9:14 am

    Very Good!!

Categories

  • Blog Tips
  • Budgeting
  • Content Marketing
  • Editorial
  • Featured Slider
  • Features
  • Gadgets
  • General
  • Guides
  • Infographic
  • Interviews
  • Keyword Research
  • Make Money Blogging
  • Marketing
  • Multimedia
  • News
  • Podcasts
  • Reviews
  • SEO
  • Social Media
  • Social Media Marketing
  • Website Security
  • WordPress
  • YouTube

The Blog Herald © 2022 Splashpress Media