簡體   English   中英

WordPress小部件不顯示

[英]Wordpress widget don't show

在這里遇到了一個奇怪的問題,所以..我已經注冊了我的小部件,並且可以鍵入/保存它。 但是,當我訪問頁面時,文本(或保存在小部件中的內容)不顯示嗎?

這是我的簡單代碼,

<?php the_widget('facebook-sidebar'); ?>

register_sidebar(array(

    'name'                  => 'Facebook',

    'id'                        => 'facebook-sidebar',

    'description'   => __( 'Located at the bottom of pages.'),

    'before_widget' => '<div id="%1$s">',

    'after_widget' => '</div>',

    'before_title' => '<h4>',

    'after_title' => '</h4>',

));

關於我可以做什么的任何建議?

代替the_widget() ,使用dynamic_sidebar('facebook-sidebar')

這樣做:

<?php 
 // Custom widget Area Start
 if ( !function_exists('facebook-sidebar') || !facebook-sidebar('Facebook') ) : ?>
<?php endif;
// Custom widget Area End
?>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM