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:
http://ift.tt/1PV9cRn and http://ift.tt/1PV9aZG
I appreciate all help!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire