WordPress页脚挂钩,PHP编辑错误

时间:2017-07-31 02:11:59

标签: php wordpress

如何编辑此内容以打印出版权所有©2017。保留所有权利。当函数的第二部分被删除时,我不断在最后一个花括号上出现错误,我无法弄明白。

 */
function nepalbuzz_get_content() {
    $theme_data = wp_get_theme();

    return sprintf( _x( 'Copyright &copy; %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>'  ) . ' &#124; ' . $theme_data->get( 'Name') . '&nbsp;' . esc_html__( 'by', 'nepalbuzz' ). '&nbsp;<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 &copy; %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>'  ) ; }

但我仍然得到一个意想不到的语法。感谢您提前的时间!

1 个答案:

答案 0 :(得分:0)

您可能只需要避开双引号。

function nepalbuzz_get_content() {
    $theme_data = wp_get_theme();

    return sprintf( _x( 'Copyright &copy; %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>'  ) ; }