danielbachhuber/Ad-Code-Manager — Issue #6: has_category conditional
Author: johnbl4ck
Created: 2012-01-20 01:43:00+00:00
State: open

Hey,

has_category produces incorrect results. For example, if we are on home page, and there's a loop with posts where ```has_category( 'news', $post_id )``` equals true, the news ad code will be added to ```$display_codes```

We don't have any control over which code to display:
```
$code_to_display = $display_codes[0];
```

If has_category conditional was evaluated before is_home conditional, wrong ad code will be rendered.

I've made a workaround for this issue: https://gist.github.com/56f5825bd42200b7b36d

I'm not sure of proper way to fix it, but we might want to implement priority.

```
array ( array( /* homepage ad code */ ) ),
'10' => array ( array( /* news ad code */ ) ),
);
// and then we just
$priority = min( array_keys( $display_codes ) ); // or max
$code_to_display = $display_codes[$priority][0]
```