我一直有這個插件的問題,另一個開發人員做的注入代碼到WordPress的function.php文件沒有操縱主題。我添加了if (!is_admin()) {
行,它解決了儀表板控件的一些問題,但現在當我嘗試連接到wordpress.com來激活Jetpack時,它將我帶到我的網站的首頁,並在我的網站正文中寫入了此錯誤消息:WordPress的functions.php擴展中的add_action('init')似乎打破了Jetpack的激活?
未找到,錯誤404 您正在查找的頁面不再存在。也許你可以回到網站的主頁,看看你是否能找到你要找的東西。或者,您可以嘗試使用下面的搜索表單來查找它。
如果我取消這個插件他們提出的Jetpack激活的工作,但我想知道是什麼原因造成的問題。很確定它與代碼的add_action('init', 'check_user_logged_in');
部分有關,但我不知道用什麼來代替它。我試過用wp_head替換init,但是它在我的頁面上打破了另一個插件的樣式。有任何想法嗎?這是下面的代碼。
<?php
/* Your code goes below here. */
ob_start();
function check_user_logged_in(){
if (!is_admin()) {
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
}
}
}
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>';
}
/* Your code goes above here. */
?>