【发布时间】:2016-12-14 23:07:48
【问题描述】:
我对编码很陌生,我刚刚接管了一个 WordPress 网站,开发人员在该网站上设置了自己的插件来编辑主题之外的 functions.php 文件。似乎有一行代码破坏了 WordPress 中的某些核心功能,例如:安装新插件失败、无法搜索主题、媒体库未加载。但是如果我停用这个插件,所有这些功能都会恢复生机,但是网站布局的某些部分会在没有插件的情况下中断。那么谁能告诉我如何修复此代码?非常感谢你。
<?php
/* Your code goes below here. */
ob_start();
function check_user_logged_in(){
if ( is_user_logged_in() ) { ?>
<style type="text/css" media="screen">
#theme-my-login-2 .widget-wrap .widget-title { display: block !important; }
</style>
<?php
}
else{ ?>
<style type="text/css" media="screen">
table.sidebar_result{margin-top:-10px;}
</style>
<?php
}
}
// Something is wrong with this next line of code. Can't find new themes or install new plugins. When removed everthing works ok.
add_action('init', 'check_user_logged_in');
// Add Read More Link to Excerpts
add_filter('excerpt_more', 'get_read_more_link');
add_filter( 'the_content_more_link', 'get_read_more_link' );
function get_read_more_link() {
return '... <a href="' . get_permalink() . '">[Read More]</a>';
}
//* Display a custom favicon
add_filter( 'genesis_pre_load_favicon', 'sp_favicon_filter' );
function sp_favicon_filter( $favicon_url ) {
return 'http://winningsportsplays.com/wspwp/wp-content/favicon.ico';
}
/* Your code goes above here. */
?>
【问题讨论】:
标签: javascript php jquery wordpress