Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

In framework settings:

$options[ 'featured_cat' ] = array( "name" => "Featured Category",
                    "desc" => "Featured Posts will display in the main  rotator on the homepage.",
                    "id" => $shortname."_cat_featured",
                    "type" => "select",
                    "options" => $woo_categories);

Updated w/ category in the settings, and it wont populate, the argument in theme is:

$rotator_args = array(
'posts_per_page' => $woo_options[ 'woo_featured_count' ],
'tax_query' => array(
    'relation' => 'AND',
    array(
        'taxonomy' => 'category',
        'terms' => array( $woo_options[ 'woo_cat_featured' ] ),
        'field' => 'ID',
        'operator' => 'IN'
    ),
    array(
        'taxonomy' => 'post_format',
        'terms' => array( 'post-format-video', 'gallery' ),
        'field' => 'slug',
        'operator' => 'NOT IN',
        ),
    )
);

It doesnt work when it's the default like that, or when I changed the settings to be what I wanted them to be (2 different category selectors).

but it does work when I simplify it to:

$rotator_args = array(
'posts_per_page' => $woo_options[ 'woo_featured_count' ],
);

Also If I just leave the 'post_format' section in the 'tax_query', it works.

Can anyone explain why woo_cat_featured wouldn't populate.

Checked already

  1. there exist posts for that category
  2. the CSS is fine
  3. I'm in the process of starting over,
    • It used to work once, then just stopped working,
      • server issue?

Working version, using the working code without the tax_query, on a customized framework. link (the backend and half the admin section randomly stopped working too, so I'm starting over).

The new version: link

share|improve this question

1 Answer 1

up vote 0 down vote accepted

So I fixed it by changing

array(
    'taxonomy' => 'category',
    'terms' => array( $woo_options[ 'woo_cat_featured' ] ),
    'field' => 'ID',
    'operator' => 'IN'
),

to

array(
    'taxonomy' => 'category',
    'terms' => array( $woo_options[ 'woo_cat_featured' ] ),
    'field' => 'slug',
    'operator' => 'IN'
),

Specifically:

    'field' => 'ID',

to

    'field' => 'slug',

.

I'm not sure what changed from one theme to the other. But this made it work perfectly.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.