开发者

How do I create a custom loop in wordpress that excludes categories listed in theme options

I have a custom loop that excludes categories using this code:

query_posts(array('category__not_in' => array(2,6)));

Instead of specifying the categories to 开发者_开发知识库exclude in the code, I'd like to be able to set the option in my custom theme options menu. The code to call the option is get_option('ex_cats');. How do I call this in my query_posts statement?


how about this query_posts(array('category__not_in' => array(get_option('ex_cats'))));

or $cats_id = get_option('ex_cats'); query_posts(array('category__not_in' => array($cats_id)));

i assume get_option('ex_cats') will return a string value.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜