Deel!

The ‘after_setup_theme’ function is where you would unload an action, filter or change parameters etc:

In the parents functions.php there is a line:if ( ! function_exists( 'twentyten_posted_on' ) ) :
This tells wordpress to only load the function if it has not already been loaded, as the child themes functions.php is run first our function is already loaded.

So the sequence is:
1. child themes functions.php
2. parent themes functions.php (any conditional functions already loaded then skip em!)
3. back to the child themes function ‘after_setup_theme’ run this to unload any parent actions or functions, declare any new variables etc

Deel!

Had some little time to explorer the functions which retrieve the posts. Until now I didn’t know the difference between query_posts and get_posts

The Codex is quiet clear on this:

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.

UPDATE: All the above is true, but….

Both functions use the same WP_Query object. Practically this means different behaviors on different pages. If the page is an category archive the WP_Query object, which is used by the above functions side by side, contains other posts then on the frontpage. The behavior is still not as I expect it to be, but bottom line is that it isn’t what I expect from it. The next post on this page sumarizes the problem with indepth knowledge:

WP uses an object called $wp_query for the main loop. We usually don’t see this object because it’s hidden behind have_posts() and the_post() that are only wrappers for $wp_query->have_posts() and $wp_query->the_post()

If you want to modify the main loop you should use query_posts() before the loop.

If you want another loop you can reutilize the $wp_query object using query_posts() before that new loop. This can be done many times if needed.

If for some reason you need to keep the $wp_query object around THEN you should use WP_Query. And of course, because have_posts() and the_post() are wrappers for $wp_query object you can’t use them with WP_Query. You should rather use $your_query_obj->have_posts() i.e.

A good case where WP_Query could be better than query_posts() is a left sidebar. As the code loop for the sidebar will probably be put on top of the main loop, a query_posts() call will have changed the $wp_query object and also changed the main loop. In this case to use query_posts()at the sidebar code you will also need to use query_posts() before the main loop to query the proper content for that loop.

So using WP_Query for this case will keep $wp_query and therefore the main loop untouched…..

Deel!

While trying to create some organization in my 12(!) blogs I’ve had since 2006 I was trying to use Post Formats to add all the bookmarks and links to my blog. I started using the blogroll which fits perfectly, but seems a little bit offroad since it isn’t easy to bookmark a link on a iPhone or by the widgets for your browser. So Post Formats seems the place to be, but aren’t as straightforward as they should be. An in-depth analysis on this subject over here. One of the comments linked to FarInSpace and this should be core functionality. It would help my clients understand WordPress much more quicker. Thumbs up for Dimas.