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.
精彩评论