2014-12-04 99 views
0

我想將邊欄上的廣告,但按鈕區會出現在WP-管理面板(外觀>窗口小部件)WordPress的側欄區域沒有出現

然而,當我把我的廣告在邊欄小部件區域,它不會出現在網站上。

我使用下面的代碼來創建小部件區域並將其放置在我的主題的fuctions.php文件中。我哪裏錯了?

 if (function_exists('register_sidebar')) { 
    register_sidebar(array( 
     'name' => 'Sidebar Widgets', 
     'id' => 'sidebar-widgets', 
     'description' => 'Widget Area', 
     'before_widget' => '<div id="one" class="two">', 
     'after_widget' => '</div>', 
     'before_title' => '<h2>', 
     'after_title' => '</h2>' 
    )); 
    } 

我將不勝感激。

以下是我的頁面模板。

<?php 
/** 
The template for displaying all pages. 
*/ 

get_header(); 

?> 

<div id="main" class="<?php echo $solid_content_class; ?> clearfix" role="main"> 
<?php 

do_action('solid_before_content'); 

while (have_posts()) : the_post(); 

get_template_part('lib/content/content', 'page'); 

endwhile; // end of the loop. 

do_action('solid_after_content'); 

// If the theme supports comments in pages and comments are open or we have at least 
one comment, load up the comment template 
if(solid_theme_supports('comments', 'pages') && (comments_open() || '0' != 
get_comments_number()) ) comments_template('', true); 

?> 
</div><!-- #main --> 

<?php if($solid_sidebar_location === 'left' || $solid_sidebar_location === 'right') 
{ ?> 

<aside id="sidebar" class="sidebar <?php echo $solid_sidebar_class; ?>"> 
    <div id="sidebar-main" class="sidebar"> 
     <?php get_sidebar(); ?> 
    </div><!--sidebar-main--> 
</aside> 

<?php } 

get_footer(); ?>' 
+0

調用等dynamic_sidebar在頁邊欄( '側邊欄插件'); – 2014-12-04 07:42:01

+1

你的頁面模板是什麼樣的?你確定你在調用側邊欄嗎? – rnevius 2014-12-04 07:43:05

+0

@mevius,謝謝你的評論。請檢查我上面添加的頁面模板。 – JMWalker 2014-12-04 09:47:57

回答

0
function debatingday_widgets_init() 
{ 
    // Primary Widget area (left, fixed sidebar) 
    register_sidebar(array(
     'name' => __('Primary Widget Area', 'debatingday'), 
     'id' => 'primary-widget-area', 
     'description' => __('Here you can put one or two of your main widgets (like an intro text, your page navigation or some social site links) in your left sidebar. The sidebar is fixed, so the widgets content will always be visible, even when scrolling down the page.', 'debatingday'), 
     'before_widget' => '<div class="s-widget" id="%1$s">', 
     'after_widget' => '</div>', 
     'before_title' => '<h5><i class="fa fa-folder-open color"></i> ', 
     'after_title' => '</h5>', 
    )); 


    // Secondary Widget area (right, additional sidebar) 
    register_sidebar(array(
     'name' => __('Secondary Widget Area', 'debatingday'), 
     'id' => 'secondary-widget-area', 
     'description' => __('Here you can put all the additional widgets for your right sidebar.', 'debatingday'), 
     'before_widget' => '<li id="%1$s" class="widget-container %2$s">', 
     'after_widget' => '</li>', 
     'before_title' => '<h3 class="widget-title">', 
     'after_title' => '</h3>', 
    )); 
} 
/* Register sidebars by running debatingday_widgets_init() on the widgets_init hook. */ 
add_action('widgets_init', 'debatingday_widgets_init');