Community Forums › Forums › Archived Forums › Design Tips and Tricks › Help with newly registered widget
- This topic has 17 replies, 2 voices, and was last updated 8 years, 11 months ago by SavvyJackie.
-
AuthorPosts
-
May 14, 2015 at 2:22 am #152134addiesgramParticipant
I registered a new custom widget (the image) and positioned it below the header. Now I need to reposition the navigation menu bar below the new custom widget. I don't know (and can't find) the correct php code to do this. The menu is currently in the Primary navigation location (Secondary location puts the menu between the header and the new custom-widget image).
TIA for assistance.
http://temporary.catherineleblancmft.comMay 14, 2015 at 5:08 am #152143SavvyJackieMemberHi,
If you can post the code you used to register the custom widget, it would be easy to see where you need to reposition the primary menu - but somethings like this code below is a good starting point. You'll want to remove the action that positions the menu and then add it back in a different spot. You may also need to edit your CSS for styling if needed.//* Reposition the primary navigation menu remove_action( 'genesis_before_header', 'genesis_do_nav' );
add_action( 'genesis_after_header', 'genesis_do_nav' );
Hope that helps.
Web Designer and Developer at Savvy Jackie Designs | Lucky with plants | @SavvyJackie
Got your question answered here? Please pay it forward by helping someone else. I’m sure there is at least one question you can answer. 🙂
May 14, 2015 at 11:56 am #152209addiesgramParticipantThank you for responding (we share the same first name : )
This is the code I used to create and position the new custom widget:
//* Register a new custom widget genesis_register_sidebar( array( 'id' => 'custom-widget', 'name' => __( 'Custom Widget', 'genesis' ), 'description' => __( 'Custom Widget Area', 'childtheme' ), ) ); //* Position the new custom widget below the header add_action( 'genesis_after_header', 'add_genesis_widget_area' ); function add_genesis_widget_area() { genesis_widget_area( 'custom-widget', array( 'before' => '<div class="custom-widget widget-area">', 'after' => '</div>', ) ); }
The code you gave me:
//* Reposition the primary navigation menu remove_action( 'genesis_before_header', 'genesis_do_nav' ); add_action( ‘genesis_after_header’, ‘genesis_do_nav’ );
placed the menu between the site title and the new custom widget -- I left it there so you can see it. Client wants the menu below the custom widget.
May 14, 2015 at 12:02 pm #152211SavvyJackieMemberOk, you're close. All you need to position the menu below the image.
Your code did not specify a priority (the default is 10) - if you don't specify.
add_action( 'genesis_after_header', 'add_genesis_widget_area' );
So given that, try adding 15 to your navigation so it appears after the image.
add_action( ‘genesis_after_header’, ‘genesis_do_nav’,15 );
Cheers,
Web Designer and Developer at Savvy Jackie Designs | Lucky with plants | @SavvyJackie
Got your question answered here? Please pay it forward by helping someone else. I’m sure there is at least one question you can answer. 🙂
May 14, 2015 at 12:15 pm #152215addiesgramParticipantlol, so close and yet so far! I'm not sure if I edited the correct code. I changed this:
//* Reposition the primary navigation menu remove_action( 'genesis_before_header', 'genesis_do_nav' ); add_action( ‘genesis_after_header’, ‘genesis_do_nav’ );
to this:
//* Reposition the primary navigation menu remove_action( 'genesis_before_header', 'genesis_do_nav' ); add_action( ‘genesis_after_header’, ‘genesis_do_nav’,15 );
The menu remains in between the site title and the custom widget.
May 14, 2015 at 12:23 pm #152217SavvyJackieMemberTry this:
//* Reposition the primary navigation menu remove_action( 'genesis_after_header', 'genesis_do_nav' ); add_action( ‘genesis_after_header’, ‘genesis_do_nav’,15 );
Web Designer and Developer at Savvy Jackie Designs | Lucky with plants | @SavvyJackie
Got your question answered here? Please pay it forward by helping someone else. I’m sure there is at least one question you can answer. 🙂
May 14, 2015 at 12:37 pm #152221addiesgramParticipantJackie, is this new code to be added, or did you mean to replace the previous "reposition" block of code?
May 14, 2015 at 12:39 pm #152223SavvyJackieMemberReplace previous code //* reposition the primary navigation menu
Web Designer and Developer at Savvy Jackie Designs | Lucky with plants | @SavvyJackie
Got your question answered here? Please pay it forward by helping someone else. I’m sure there is at least one question you can answer. 🙂
May 14, 2015 at 12:46 pm #152225addiesgramParticipantThanks for clarifying. When I replaced with the new code the menu went into hiding.
May 14, 2015 at 12:53 pm #152228SavvyJackieMemberWould you mind posting the entire code in your functions.php file?
Web Designer and Developer at Savvy Jackie Designs | Lucky with plants | @SavvyJackie
Got your question answered here? Please pay it forward by helping someone else. I’m sure there is at least one question you can answer. 🙂
May 14, 2015 at 12:56 pm #152230SavvyJackieMemberCan you also confirm you have set your menu to the primary location in Menu > Manage Locations?
Web Designer and Developer at Savvy Jackie Designs | Lucky with plants | @SavvyJackie
Got your question answered here? Please pay it forward by helping someone else. I’m sure there is at least one question you can answer. 🙂
May 14, 2015 at 12:57 pm #152232addiesgramParticipantDon't mind at all -- I really appreciate the time you're taking with my challenge. Here it is (the funky characters you see in the Reposition block below do not actually look like that in my php file, they show as the single apostrophes):
<?php //* Start the engine include_once( get_template_directory() . '/lib/init.php' ); //* Setup Theme include_once( get_stylesheet_directory() . '/lib/theme-defaults.php' ); //* Set Localization (do not remove) load_child_theme_textdomain( 'lifestyle', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'lifestyle' ) ); //* Child theme (do not remove) define( 'CHILD_THEME_NAME', __( 'Lifestyle Pro Theme', 'lifestyle' ) ); define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/lifestyle/' ); define( 'CHILD_THEME_VERSION', '3.1' ); //* Add HTML5 markup structure add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption' ) ); //* Add viewport meta tag for mobile browsers add_theme_support( 'genesis-responsive-viewport' ); //* Enqueue Scripts add_action( 'wp_enqueue_scripts', 'lifestyle_load_scripts' ); function lifestyle_load_scripts() { wp_enqueue_script( 'lifestyle-responsive-menu', get_bloginfo( 'stylesheet_directory' ) . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0' ); wp_enqueue_style( 'dashicons' ); wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Droid+Sans:400,700|Roboto+Slab:400,300,700', array(), CHILD_THEME_VERSION ); } //* Add new image sizes add_image_size( 'home-large', 634, 360, TRUE ); add_image_size( 'home-small', 266, 160, TRUE ); //* Add support for custom background add_theme_support( 'custom-background', array( 'default-image' => get_stylesheet_directory_uri() . '/images/bg.png', 'default-color' => 'efefe9', ) ); //* Add support for custom header add_theme_support( 'custom-header', array( 'header_image' => '', 'header-selector' => '.site-title a', 'header-text' => false, 'height' => 110, 'width' => 320, ) ); //* Register a new custom widget genesis_register_sidebar( array( 'id' => 'custom-widget', 'name' => __( 'Custom Widget', 'genesis' ), 'description' => __( 'Custom Widget Area', 'childtheme' ), ) ); //* Position the new custom widget below the header add_action( 'genesis_after_header', 'add_genesis_widget_area' ); function add_genesis_widget_area() { genesis_widget_area( 'custom-widget', array( 'before' => '<div class="custom-widget widget-area">', 'after' => '</div>', ) ); } //* Add support for additional color style options add_theme_support( 'genesis-style-selector', array( 'lifestyle-pro-blue' => __( 'Lifestyle Pro Blue', 'lifestyle' ), 'lifestyle-pro-green' => __( 'Lifestyle Pro Green', 'lifestyle' ), 'lifestyle-pro-mustard' => __( 'Lifestyle Pro Mustard', 'lifestyle' ), 'lifestyle-pro-purple' => __( 'Lifestyle Pro Purple', 'lifestyle' ), 'lifestyle-pro-red' => __( 'Lifestyle Pro Red', 'lifestyle' ), ) ); //* Reposition the primary navigation menu remove_action( 'genesis_after_header', 'genesis_do_nav' ); add_action( ‘genesis_after_header’, ‘genesis_do_nav’,15 ); //* Modify the size of the Gravatar in the author box add_filter( 'genesis_author_box_gravatar_size', 'lifestyle_author_box_gravatar' ); function lifestyle_author_box_gravatar( $size ) { return 96; } //* Modify the size of the Gravatar in the entry comments add_filter( 'genesis_comment_list_args', 'lifestyle_comments_gravatar' ); function lifestyle_comments_gravatar( $args ) { $args['avatar_size'] = 60; return $args; } //* Remove comment form allowed tags add_filter( 'comment_form_defaults', 'lifestyle_remove_comment_form_allowed_tags' ); function lifestyle_remove_comment_form_allowed_tags( $defaults ) { $defaults['comment_notes_after'] = ''; return $defaults; } //* Add support for 3-column footer widgets add_theme_support( 'genesis-footer-widgets', 3 ); //* Add support for after entry widget add_theme_support( 'genesis-after-entry-widget-area' ); //* Relocate after entry widget remove_action( 'genesis_after_entry', 'genesis_after_entry_widget_area' ); add_action( 'genesis_after_entry', 'genesis_after_entry_widget_area', 5 ); //* Register widget areas genesis_register_sidebar( array( 'id' => 'home-top', 'name' => __( 'Home - Top', 'lifestyle' ), 'description' => __( 'This is the top section of the homepage.', 'lifestyle' ), ) ); genesis_register_sidebar( array( 'id' => 'home-middle', 'name' => __( 'Home - Middle', 'lifestyle' ), 'description' => __( 'This is the middle section of the homepage.', 'lifestyle' ), ) ); genesis_register_sidebar( array( 'id' => 'home-bottom-left', 'name' => __( 'Home - Bottom Left', 'lifestyle' ), 'description' => __( 'This is the bottom left section of the homepage.', 'lifestyle' ), ) ); genesis_register_sidebar( array( 'id' => 'home-bottom-right', 'name' => __( 'Home - Bottom Right', 'lifestyle' ), 'description' => __( 'This is the bottom right section of the homepage.', 'lifestyle' ), ) );
May 14, 2015 at 1:03 pm #152236addiesgramParticipantPrimary nav location confirmed : )
May 14, 2015 at 1:07 pm #152237SavvyJackieMemberLooks like you've got some funky characters in the code you pasted in. Try deleting that and retyping manually.
Whenever I cut and paste code - I usually paste it into a plain text editor and they recopy it to my clipboard and then paste in my functions.php.
What program are you using to edit the functions.php file?
Web Designer and Developer at Savvy Jackie Designs | Lucky with plants | @SavvyJackie
Got your question answered here? Please pay it forward by helping someone else. I’m sure there is at least one question you can answer. 🙂
May 14, 2015 at 1:17 pm #152238addiesgramParticipantI use Sublime and TextEdit. I thought I had moved that code into TextEdit and checked before putting in the php file, but I may have forgotten. In any event, I've manually corrected the code in php:
'genesis_do_nav',15 );
but the menu is still not showing.
May 14, 2015 at 1:24 pm #152240SavvyJackieMemberLooks like you have bad characters in genesis_after_header also:
add_action( ‘genesis_after_header’, ‘genesis_do_nav’,15 );
Web Designer and Developer at Savvy Jackie Designs | Lucky with plants | @SavvyJackie
Got your question answered here? Please pay it forward by helping someone else. I’m sure there is at least one question you can answer. 🙂
May 14, 2015 at 1:46 pm #152241addiesgramParticipantWow -- I couldn't see those bad characters in Sublime OR in TextEdit. So I retyped that whole string manually and now the menu is where I wanted it.
I am so appreciative of all the time you've taken with this. Thank you again. BTW I went exploring your website while waiting for your responses -- it's a lovely site and I've bookmarked it for future tips. I'm a psychotherapist in California helping some of my therapist colleagues build their websites as they're building their practices. I've learned a lot (self-taught) but I have a long way to go and the help you've given me here will undoubtedly help me with future sites. Responsive design has really pushed me past the edge of my skills.
Thanks again -- I'll mark this issue as resolved.
May 14, 2015 at 1:53 pm #152244SavvyJackieMemberYou're most welcome. We all started as beginners at one point. I'm learning new things everyday. There are a lot of helpful sites about Genesis, and that is where I started looking when I first begin with using it.
Enjoy the journey.
Web Designer and Developer at Savvy Jackie Designs | Lucky with plants | @SavvyJackie
Got your question answered here? Please pay it forward by helping someone else. I’m sure there is at least one question you can answer. 🙂
-
AuthorPosts
- The topic ‘Help with newly registered widget’ is closed to new replies.