如何编辑此内容以打印出版权所有©2017。保留所有权利。当函数的第二部分被删除时,我不断在最后一个花括号上出现错误,我无法弄明白。
*/
function nepalbuzz_get_content() {
$theme_data = wp_get_theme();
return sprintf( _x( 'Copyright © %1$s %2$s. All Rights Reserved', '1: Year, 2: Site Title with home URL', 'nepalbuzz' ), date_i18n( __( 'Y', 'nepalbuzz' ) ), '<a href="'. esc_url( home_url( '/' ) ) .'">'. esc_attr( get_bloginfo( 'name', 'display' ) ) . '</a>' ) . ' | ' . $theme_data->get( 'Name') . ' ' . esc_html__( 'by', 'nepalbuzz' ). ' <a target="_blank" href="'. $theme_data->get( 'AuthorURI' ) .'">'. $theme_data->get( 'Author' ) .'</a>';
}
我已编辑过:
function nepalbuzz_get_content() {
$theme_data = wp_get_theme();
return sprintf( _x( 'Copyright © %1$s %2$s. All Rights Reserved', '1: Year, 2: Site Title with home URL', 'nepalbuzz' ), date_i18n( __( 'Y', 'nepalbuzz' ) ), '<a href="'. esc_url( home_url( '/' ) ) .'">'. esc_attr( get_bloginfo( 'name', 'display' ) ) . '</a>' ) ; }
但我仍然得到一个意想不到的语法。感谢您提前的时间!
答案 0 :(得分:0)
您可能只需要避开双引号。
function nepalbuzz_get_content() {
$theme_data = wp_get_theme();
return sprintf( _x( 'Copyright © %1$s %2$s. All Rights Reserved', '1: Year, 2: Site Title with home URL', 'nepalbuzz' ), date_i18n( __( 'Y', 'nepalbuzz' ) ), '<a href=\"'. esc_url( home_url( '/' ) ) .'\">'. esc_attr( get_bloginfo( 'name', 'display' ) ) . '</a>' ) ; }