0
我有一個WordPress主題從我下載的主題的側邊欄WordPress站點。不能改變WordPress的側邊欄項目
在外觀>菜單我創建了一個新菜單,然後我將側欄菜單下拉列表設置爲新創建的菜單,但是當您訪問網站時,它沒有區別。舊菜單仍然存在。 ..
所以我看着從主題代碼編輯器,我無法弄清楚如何改變它,它從我的新創建菜單的作品,我希望有人也許能夠幫助我..這是sidebar.php代碼和sidebar-init.php
sidebar-init.php
<?php
function elegance_widgets_init() {
// Header Widget
// Location: right after the navigation
register_sidebar(array(
'name' => 'Header',
'id' => 'header-sidebar',
'description' => __('Located at the top of pages.'),
'before_widget' => '<div id="%1$s" class="widget">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
// Sidebar Widget
// Location: the sidebar
register_sidebar(array(
'name' => 'Sidebar',
'id' => 'main-sidebar',
'description' => __('Located at the right side of pages.'),
'before_widget' => '<div id="%1$s" class="widget">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
// Contact Form Widget
// Location: Contacts page
register_sidebar(array(
'name' => 'Contact Form',
'id' => 'contact_form',
'description' => __('Located at the left side of Contacts page.'),
'before_widget' => '<div id="%1$s">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
// Address Widget
// Location: Contacts page
register_sidebar(array(
'name' => 'Address',
'id' => 'address',
'description' => __('Located at the right side of Contacts page.'),
'before_widget' => '<div id="%1$s" class="widget">',
'after_widget' => '</div>',
'before_title' => '<h3>',
'after_title' => '</h3>',
));
// Footer Widget Area
// Location: at the top of the footer, above the copyright
register_sidebar(array(
'name' => 'First footer widget area',
'id' => 'first-footer-widget-area',
'description' => __('Located at the bottom of pages.'),
'before_widget' => '<div id="%1$s" class="widget-area">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
// Footer Widget Area
// Location: at the top of the footer, above the copyright
register_sidebar(array(
'name' => 'Second footer widget area',
'id' => 'second-footer-widget-area',
'description' => __('Located at the bottom of pages.'),
'before_widget' => '<div id="%1$s" class="widget-area">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
// Footer Widget Area
// Location: at the top of the footer, above the copyright
register_sidebar(array(
'name' => 'Third footer widget area',
'id' => 'third-footer-widget-area',
'description' => __('Located at the bottom of pages.'),
'before_widget' => '<div id="%1$s" class="widget-area">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
// Footer Widget Area
// Location: at the top of the footer, above the copyright
register_sidebar(array(
'name' => 'Fourth footer widget area',
'id' => 'fourth-footer-widget-area',
'description' => __('Located at the bottom of pages.'),
'before_widget' => '<div id="%1$s" class="widget-area">',
'after_widget' => '</div>',
'before_title' => '<h4>',
'after_title' => '</h4>',
));
}
/** Register sidebars by running elegance_widgets_init() on the widgets_init hook. */
add_action('widgets_init', 'elegance_widgets_init');
?>
的sidebar.php
<aside id="sidebar" class="grid_6 omega">
<?php if (! dynamic_sidebar('Sidebar')) : ?>
<div id="sidebar-nav" class="widget menu">
<h3>Navigation</h3>
<?php wp_nav_menu(array('menu' => 'Sidebar Menu')); ?> <!-- editable within the Wordpress backend -->
</div>
<?php endif; ?>
</aside><!--sidebar-->
任何幫助,將理解
此外,請確保在appearence->小部件 - >側欄確保這是空的,沒有小部件在該地區,或您的菜單不會顯示!.. – Marty
好吧這工作得到的條目改變!這讓我感到興奮,因爲它讓我花了很多時間在這裏得到任何地方......但它改變了菜單的風格..我會在我的問題之前和之後添加照片,以便您有更好的主意。 – HurkNburkS
其實我似乎無法得到它現在... :(會繼續努力會讓你知道我是如何去..但你知道我爲什麼我失去了我的風格,當我使用此代碼 – HurkNburkS