gpl

Where to put my code: plugin or functions.php?

Question: Is there an easy to understand scheme to decide what kind of code belongs to a plugin or the theme’s functions.php? There are many cases and many debates about that topic, mostly because there are some misconceptions about the inner workings of WordPress. I am asking for an answer based on facts, not on opinions. It should explain how to handle these points …

Where to put my code: plugin or functions.php? Read More »

Some doubts about how the main query and the custom query works in this custom theme?

Question: I am pretty new in WordPress theme development and I’m not so into PHP (I came from Java and C#) and have the following situation in this custom theme As you can see in the homepage I first show a section (named Articoli in evidenza) containing the featured posts (I’ve implemented it using a specific tag) and under …

Some doubts about how the main query and the custom query works in this custom theme? Read More »

query functions

When should you use WP_Query vs query_posts() vs get_posts()?

It seems like half the tutorials in the Codex and around the blogosphere use query_posts() and half use WP_Query. They all do similar things, so when should I use one over the others? Answer: query_posts() is overly simplistic and a problematic way to modify the main query of a page by replacing it with new instance of the query. It is …

When should you use WP_Query vs query_posts() vs get_posts()? Read More »