我正在尝试破解一个插件,在一个插件/小部件中的帖子标题上方插入帖子的类别名称,该插件/小部件在首页的一行中显示三篇帖子。
我尝试的黑客行为如下所示,但虽然它在localhost上起作用,但在我的实时安装中却不起作用——这就是我尝试在函数中添加的黑客行为。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\' );
主题中与插件/小部件相关的文件如下:
http://pastebin.com/X210VebN 和http://pastebin.com/Q7ugkAJr
我感谢所有的帮助!