在我的主题中的PHP
文件中编辑模板后,我按下了保存更改,在我收到HTTP 500 ERROR后,现在我试图将代码粘贴回完全相同的位置,它仍然是返回错误。修复代码的解决方案是什么?
CODE
function the_archive_title( $before = '', $after = '' ) {
if ( is_category() ) {
$title = sprintf( __( 'Category: %s', 'tesseract' ), single_cat_title( '', false ) );
} elseif ( is_tag() ) {
$title = sprintf( __( 'Tag: %s', 'tesseract' ), single_tag_title( '', false ) );
} elseif ( is_author() ) {
$title = sprintf( __( 'Author: %s', 'tesseract' ), '<span class="vcard">' . get_the_author() . '</span>' );
}
} elseif ( is_tag() ) {
$title = sprintf( __( 'Tag: %s', 'tesseract' ), single_tag_title( '', false ) );
} elseif ( is_author() ) {
$title = sprintf( __( 'Author: %s', 'tesseract' ), '<span class="vcard">' . get_the_author() . '</span>' );
} elseif ( is_year() ) {
$title = sprintf( __( 'Year: %s', 'tesseract' ), get_the_date( _x( 'Y', 'yearly archives date format', 'tesseract' ) ) );
} elseif ( is_month() ) {
$title = sprintf( __( 'Month: %s', 'tesseract' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'tesseract' ) ) );
} elseif ( is_day() ) {
$title = sprintf( __( 'Day: %s', 'tesseract' ), get_the_date( _x( 'F j, Y', 'daily archives date format', 'tesseract' ) ) );
} elseif ( is_tax( 'post_format', 'post-format-aside' ) ) {
$title = _x( 'Asides', 'post format archive title', 'tesseract' );
} elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) {
$title = _x( 'Galleries', 'post format archive title', 'tesseract' );
} elseif ( is_tax( 'post_format', 'post-format-image' ) ) {
$title = _x( 'Images', 'post format archive title', 'tesseract' );
} elseif ( is_tax( 'post_format', 'post-format-video' ) ) {
$title = _x( 'Videos', 'post format archive title', 'tesseract' );
} elseif ( is_tax( 'post_format', 'post-format-quote' ) ) {
$title = _x( 'Quotes', 'post format archive title', 'tesseract' );
} elseif ( is_tax( 'post_format', 'post-format-link' ) ) {
$title = _x( 'Links', 'post format archive title', 'tesseract' );
} elseif ( is_tax( 'post_format', 'post-format-status' ) ) {
$title = _x( 'Statuses', 'post format archive title', 'tesseract' );
} elseif ( is_tax( 'post_format', 'post-format-audio' ) ) {
$title = _x( 'Audio', 'post format archive title', 'tesseract' );
} elseif ( is_tax( 'post_format', 'post-format-chat' ) ) {
$title = _x( 'Chats', 'post format archive title', 'tesseract' );
} elseif ( is_post_type_archive() ) {
$title = sprintf( __( 'Archives: %s', 'tesseract' ), post_type_archive_title( '', false ) );
} elseif ( is_tax() ) {
$tax = get_taxonomy( get_queried_object()->taxonomy );
/* translators: 1: Taxonomy singular name, 2: Current taxonomy term */
$title = sprintf( __( '%1$s: %2$s', 'tesseract' ), $tax->labels->singular_name, single_term_title( '', false ) );
} else {
$title = __( 'Archives', 'tesseract' );
}
答案 0 :(得分:0)
您是如何尝试粘贴代码的?
如果您修改了 functions.php 文件并在外观&gt;中执行了此操作编辑并且没有刷新页面,您可能会直观地看到恢复的代码被保存,但实际上外观编辑器什么也没做,因为 functions.php 中存在错误。
解决方案是使用其他方式(如cPanel / Plesk中的编辑器)还原 functions.php 中的代码。