AudioJungle

Display category extra fields in homepage

8 posts
  • Exclusive Author
  • Has been a member for 2-3 years
  • Europe
codeex says

Hello,

I have extra field in my post category and I want to display the subtitle in homepage but I can’t seem to fix it.. can you help me with this.. here’s my code:

$categories = get_categories();      
foreach ($categories as $cats) {
$category_id = get_query_var('cat'); 
$category_data = get_option("category_$category_id");
<h5><?php echo $cats->name; ?></h5> 
<?php echo "test" . $cats->$category_data['subtitle'];; ?>
}

did I miss something here…

thanks

589 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Has been a member for 2-3 years
  • Europe
  • Exclusive Author
  • Referred between 10 and 49 users
  • Bought between 100 and 499 items
WPScientist says

Seems like the forum ate a bit of the code.

Try…

$category_data['subtitle']

...instead of…

$cats->$category_data['subtitle']
by
by
by
by
by