I'm trying to modify the output of a loop on an archive page for a specific list of categories. Normally this loop outputs the Title, Author, Date and does so for every post in that given category.
I have a list of categories in which I'd like to modify that output to include images. Up until now I've accomplished this by using if statements like below:
class new_loop extends theme_custom_loop {
function modify_categories() {
$cat1 = '101';
$cat2 = '201';
if (is_category($cat1)) {
echo 'stuff';
}
elseif (is_category($cat2)) {
echo 'stuff';
}
else theme_loop();
}
}
Now I have a list of about 40 categories. I've tried to store them in an array and run them through a loop but it doesn't seem to work. Any advice? Current code is:
class new_loop extends theme_custom_loop {
function modify_categories() {
$archive_categories = array(
'101',
'201'
);
foreach($archive_categories as $archive_category) {
if (is_category($archive_category)) {
echo 'stuff';
}
else theme_loop();
}
}
}