232 posts
  • Has sold $40,000+ on Envato Market
  • Sells items exclusively on Envato Market
  • Has referred 1+ members
  • Has collected 1+ items on Envato Market
+2 more
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 more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Made it to the Authors' Hall of Fame
  • Sells items exclusively on Envato Market
+5 more
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