108 posts
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 1 and 9 items
  • Has been a member for 3-4 years
  • Austria
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

590 posts
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Has been a member for 3-4 years
  • Europe
  • Exclusive Author
  • Referred between 50 and 99 users
  • Bought between 100 and 499 items
CodeSwift 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
by