Rearrange sidebar widgets and menus
-
Hey guys!
I am having a hard time trying to figure out how to rearrange the sidebar of my site. Right now my sidebar looks like this: a custom menu of my pages, two image widgets, and then social media icons. I would like it to be the image widgets, the menu of pages, then my social media icons. How can I do this? I’ve already tried to add my custom menu to my widgets, but it changes the appearance of the menu.
-
http://codex.wordpress.org/Forum_Welcome#Include_as_Much_Information_as_Possible
what theme are you using?
are you using widgets under ‘dashboard – appearance – widgets’?
I’m using the theme Madeini which is a child theme of TwentyFourteen I believe. And I am using widgets under ‘dashboard-appearance – widgets’ to order my images and social media icons. I’ve tried using the custum menu option under widgets, but I like the look that I get from ‘dashboard- appearance – menus’ better.
here is a link to my site http://www.srcgraphics.com
the menu is hardcoded into the first position of the sidebar – to change that, you might need to create a new sidebar.php in your child theme, and/or edit functions.php as well…
for example, you could add a new widget area for widgets to appear above the menu:
add this new sidebar.php into the child theme:
<?php /** * The Sidebar containing the main widget area * * @package WordPress * @subpackage Twenty_Fourteen * @since Twenty Fourteen 1.0 */ ?> <div id="secondary"> <?php $description = get_bloginfo( 'description', 'display' ); if ( ! empty ( $description ) ) : ?> <h2 class="site-description"><?php echo esc_html( $description ); ?></h2> <?php endif; ?> <?php if ( is_active_sidebar( 'sidebar-4' ) ) : ?> <div id="primary-sidebar-top" class="primary-sidebar widget-area" role="complementary"> <?php dynamic_sidebar( 'sidebar-4' ); ?> </div><!-- #primary-sidebar-top --> <?php endif; ?> <?php if ( has_nav_menu( 'secondary' ) ) : ?> <nav role="navigation" class="navigation site-navigation secondary-navigation"> <?php wp_nav_menu( array( 'theme_location' => 'secondary' ) ); ?> </nav> <?php endif; ?> <?php if ( is_active_sidebar( 'sidebar-1' ) ) : ?> <div id="primary-sidebar" class="primary-sidebar widget-area" role="complementary"> <?php dynamic_sidebar( 'sidebar-1' ); ?> </div><!-- #primary-sidebar --> <?php endif; ?> </div><!-- #secondary -->
add this to the bottom of functions.php of your child theme:
/** * Register fourth widget area for above sidebar menu. */ function madeini_widgets_init() { register_sidebar( array( 'name' => __( 'Primary Sidebar Top', 'twentyfourteen' ), 'id' => 'sidebar-4', 'description' => __( 'Main sidebar on the left, widgets above menu.', 'twentyfourteen' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h1 class="widget-title">', 'after_title' => '</h1>', ) ); } add_action( 'widgets_init', 'madeini_widgets_init', 9 );
(not widely tested)
for other ideas, and further details, please post in your theme’s forum at https://wordpress.org/support/theme/madeini#postform
Ok I created a new sidebar.php page and added the code to the functions.php page. It created an option to add widgets above the menu, I added two image widgets. But when I view my page, I don’t see any of the widgets I just added. I can only see the widgets below the menu.
you might need to clear the cache;
<!-- Cached page generated by WP-Super-Cache on 2015-05-25 01:00:29 -->
Is there another way to clear the cache besides going into WP-Super-Cache and deleting everything? I tried, and I still can’t see my widgets in the sidebar.
Nothing works. I tried re-copying the code. Still can’t see anything
what are the exact full codes of sidebar.php and functions.php of the child theme?
- The topic ‘Rearrange sidebar widgets and menus’ is closed to new replies.