How to insert category name above post title in a featured pages plugin?
-
I’m trying to hack a plugin to insert the category name of the post above the post title in a plugin/widget that displays three posts in a single row on the front page.
The hack I tried is as follows, but while it worked on localhost it did not work on my live installation – this is the hack I tried to be added at functions.php:
$count = 1; function custom_cat_before_featured_page_title($tc_fp_title_block , $featured_page_title = '' ){ $o = get_option('tc_pro_fpu'); global $count; if($count == 1){ $value = 'one'; } if($count == 2){ $value = 'two'; } if($count == 3){ $value = 'three'; } $value = $count; @$id = $o["tc_featured_page_{$value}"]; @$categories = get_the_category_list( ", ", "", $id ); $cat = ''; if(!empty($categories)){ $cat = ' <div class="customizr-fpc-category">' . $categories . '</div>'; } $count++; return $cat.$tc_fp_title_block; } add_filter( 'fpc_title_block', 'custom_cat_before_featured_page_title' );
The files related to the plugin/widget in the theme are as follows:
https://pastebin.com/X210VebN
https://pastebin.com/Q7ugkAJrI appreciate all help!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘How to insert category name above post title in a featured pages plugin?’ is closed to new replies.