MonkeyBoo
MonkeyBoo

Reputation: 147

Replacing query_posts() function in Wordpress

I'd like to create a custom function to replace query_posts(). This custom function needs to include certain custom post types.

I know that you can use query_posts() and specify post_type array as an argument, but since this particular custom query posts will be used on multiple page templates, I'd like to avoid editing multiple templates when new custom post type is created.

So, I'm looking for something like

mycustom_query_posts($args) to call on my page templates. The question is, how does one create this mycustom_query_posts($args)?

Thanks beforehand!

Upvotes: 0

Views: 242

Answers (1)

maiorano84
maiorano84

Reputation: 11951

Wordpress already did it for you:

WP_Query

Upvotes: 0

Related Questions