2012-01-27 68 views
0

你能幫我一下嗎?我正在構建基於不同頁面顯示不同內容的插件。 例如,在第1頁上會有一個內容,在第2頁上,其他內容將保持原樣。 這裏是我的插件代碼(我需要的內容,只改變特定的頁面):wordpress插件不同頁面上的不同內容

$content = get_the_content(); 
$content = apply_filters('the_content', $content); 
$content = str_replace(']]>', ']]>', $content); 

wp_enqueue_script('ajax_bill', '/wp-content/plugins/ed-merna-mesta/js/ajax_bill.js'); 
wp_enqueue_style('styles', '/wp-content/plugins/ed-merna-mesta/css/styles.css'); 
include_once("php/functions.php"); 
include_once("php/functions_helper.php"); 

add_filter('the_content','get_plugin_page_content', $content);  

function get_plugin_page_content($content) { 
    if (is_page('page1')) { 
     get_accounts_list(); 
    } 
    else if (is_page('page2')) 
    { 
     last_account_bill(); 
    } 
    else 
     echo $content;  
} 

問題是該主頁顯示像(我有一些隨機文本): [one_third] 許多字體包括 [icon_pencil] Quisque convallis orci ut lacus sed imperdiet eget lobortis dolor tellus pharetra。在hac dolor habitasse platea dictumst。 Integer sedelor risus坐着韌帶。 Lorem ipsum dolor以驚人的速度坐在amet平臺上。 Quisque convallis orciut lacus sed imperdiet eget lobortis dolor tellus pharetra。 [button url =「#」]閱讀全文... [/ button] [/ one_third] [one_third]

顯示內容時出現問題! 當我註釋行: add_filter('the_content','get_plugin_page_content',$ content);
一切都可以在首頁(當然插件沒有顯示任何東西)。

我正在使用clear-theme。 我哪裏錯了?

謝謝。

回答

0

,如果有人跌倒到同樣的問題,我想通了:

我需要:

do_shortcode($content); 
相關問題