我正在尝试从我的wordpress网站取消主题功能,并且刚刚开始添加替换自定义功能(我还没有添加代码来解开主题功能或挂钩我的新功能)但我收到了现在所有页面上都出现此错误消息:
解析错误:语法错误,第49行/home/officeke/public_html/wp-content/themes/classipress-child/functions.php中的意外'}'
我添加到functions.php文件底部的代码是:
<?php
// use this custom code to remove the tags or no tags text from the bottom of adverts
function cp_blog_post_meta_footer_custom() {
global $post, $cp_options;
if ( ! is_singular( array( 'post', APP_POST_TYPE ) ) )
return;
?>
<?php
}
?>
但是,如果我从上一个?>
和最后一个<?php
行删除了第二行,那么代码如下所示:
<?php
// use this custom code to remove the tags or no tags text from the bottom of adverts
function cp_blog_post_meta_footer_custom() {
global $post, $cp_options;
if ( ! is_singular( array( 'post', APP_POST_TYPE ) ) )
return;
}
?>
我没有收到错误,但我不明白为什么。谁能帮助解释我做错了什么?
我的functions.php文件中的完整代码是:
<?php
// let's remove the default ClassiPress theme loop else code
function unhook_appthemes_functions() {
remove_action('appthemes_loop_else', 'cp_ad_loop_else');
//remove_action('appthemes_after_post_content', 'cp_blog_post_meta_footer');
}
add_action('init','unhook_appthemes_functions');
// use this custom loop else code instead
function cp_ad_loop_else_custom() {
?>
<div class="shadowblock_out">
<div class="shadowblock">
<div class="pad10"></div>
<p><?php _e( 'Sorry, no properties were found.', APP_TD ); ?></p>
<div class="pad50"></div>
</div><!-- /shadowblock -->
</div><!-- /shadowblock_out -->
<?php
}
add_action('appthemes_loop_else', 'cp_ad_loop_else_custom');
// display the login message in the header
if (!function_exists('cp_login_head_custom')) {
function cp_login_head_custom() {
if (is_user_logged_in()) :
global $current_user;
$current_user = wp_get_current_user();
$display_user_name = cp_get_user_name();
$logout_url = cp_logout_url();
?>
<?php _e( 'Logged in as ', APP_TD ); ?> <strong><?php echo $display_user_name; ?></strong> [ <a href="<?php echo CP_DASHBOARD_URL; ?>"><?php _e( 'My Account', APP_TD ); ?></a> | <a href="<?php echo $logout_url; ?>"><?php _e( 'Log out', APP_TD ); ?></a> ]
<?php else : ?>
<?php _e( 'Not logged in', APP_TD ); ?> [ <a href="<?php echo appthemes_get_registration_url(); ?>"><?php _e( 'Register', APP_TD ); ?></a> | <a href="<?php echo wp_login_url(); ?>"><?php _e( 'Login', APP_TD ); ?></a> ]
<?php endif;
}
}
?>
<?php
// use this custom code to remove the tags or no tags text from the bottom of adverts
function cp_blog_post_meta_footer_custom() {
global $post, $cp_options;
if ( ! is_singular( array( 'post', APP_POST_TYPE ) ) )
return;
}
?>
非常感谢
罗宾