tags:

views:

41

answers:

2

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?

A: 

what is the output of get_option('ex_cats'); ?

mroggle
A: 

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.

justjoe
Perfect, that's exactly what I needed, particularly defining $cats_id and inserting that. I ended up putting it in an associative array so I could add some other parameters. Thanks!
matt