WP_Query by just the id?

any should retrieve any type: $args = array( ‘p’ => 42, // ID of a page, post, or custom type ‘post_type’ => ‘any’ ); $my_posts = new WP_Query($args); Note the description of any in the documentation: ‘any’ – retrieves any type except revisions and types with ‘exclude_from_search’ set to true. For more information, have a … Read more

Passing variables through locate_template

Like MathSmath wrote, get_template() does not support the re-use of your variables. But locate_template() infact does no inclusion at all. It just locates a file for inclusion. So you can make use of include to have this working just like you expect it: include(locate_template(‘custom-template-part.php’)); $var from your example can be used in the template part … Read more

Need help with add_rewrite_rule

Some background on rewrite rules The WP Rewrite system looks complicated, but in fact it’s not that hard to understand how it works. It is used to parse pretty URLs (/designers/) as if they were non-pretty (/index.php?pagename=designers). The basic idea is that you have a list of rewrite rules, regular expressions that can match the … Read more