【发布时间】:2015-01-15 18:35:16
【问题描述】:
我正在尝试使用子主题 function.php 文件中的函数覆盖父主题 function.php 文件,但我遇到了一些错误。到目前为止,这是我所做的......
function remove_et_postinfo_meta_actions() {
remove_action('after_setup_theme','et_postinfo_meta',3);
}
add_action('init', 'remove_et_postinfo_meta_actions');
add_action('after_setup_theme', 'cc_et_postinfo_meta', 3);
if ( ! function_exists( 'cc_et_postinfo_meta' ) ){
function cc_et_postinfo_meta( $postinfo, $date_format, $comment_zero, $comment_one, $comment_more ){
global $themename;
$postinfo_meta = '';
if ( in_array( 'author', $postinfo ) ){
$postinfo_meta .= ' ' . esc_html__('by',$themename) . ' ' . et_get_the_author_posts_link();
}
if ( in_array( 'date', $postinfo ) )
$postinfo_meta .= ' ' . esc_html__('on',$themename) . ' ' . get_the_time( $date_format );
if ( in_array( 'categories', $postinfo ) )
$postinfo_meta .= ' ' . esc_html__('in',$themename) . ' ' . get_the_category_list(', ');
if ( in_array( 'comments', $postinfo ) )
$postinfo_meta .= ' ' . et_get_comments_popup_link( $comment_zero, $comment_one, $comment_more );
if ( '' != $postinfo_meta ) $postinfo_meta = __('Posted',$themename) . ' ' . $postinfo_meta;
echo $postinfo_meta;
}
}
【问题讨论】:
标签: php wordpress wordpress-theming