Community Forums › Forums › Archived Forums › Design Tips and Tricks › Adding Custom Content to footer-widget div
- This topic has 3 replies, 2 voices, and was last updated 9 years, 1 month ago by Tonya.
-
AuthorPosts
-
February 12, 2015 at 1:44 pm #140632[email protected]Member
Does anyone here know how I could add a small amount of html content to div.footer-widgets but before div.wrap without resorting to jQuery? Any suggestions are very welcome.
February 12, 2015 at 3:03 pm #140641TonyaMemberSure, I'd hook into "genesis_markup_footer-widgets_output". Let me explain:
1) If you look in genesis/lib/structure/footer.php and around line 62, you see that the footer-widgets div is created by calling genesis_markup and passing the context of 'footer-widgets'. Now you need to take a look at genesis_markup() to see where you can hook in to modify the content.
2) genesis_markup() is found in genesis/lib/functions/markup.php. Head down to line 68 and you'll see that the $tag is assigned through a filter "genesis_markup_{$args['context']}_output". I noted above that the context is set to "footer-widgets"; therefore, you want to hook into "genesis_markup_footer-widgets_output" as follows:
add_filter('genesis_markup_footer-widgets_output', 'callback_to_add_html_after_opening_footer_widgets', 10, 2); /** * Add content after the opening footer-widgets div * * @since 1.0.0 * * @param string $tag HTML * @param array $args Array of the args * @return string Amended HTML string */ function callback_to_add_html_after_opening_footer_widgets( $tag, $args ) { $tag .= '<div class="your-class-here">This is where you would put your HTML</div>'; return $tag; }
Cheers,
Tonya
Software & Electrical Engineer and Programming Teacher · I’m on a mission to help developers be more awesome.
Find Me: KnowTheCode.io | @hellofromTonya | Profitable WordPress Developer BootcampFebruary 13, 2015 at 12:06 pm #140723[email protected]MemberThank you Tonya. This worked great for me! 🙂
It also gives me something to follow up on and reference for future development. I am just getting into Genesis but I am very eager to learn more tips and tricks. Right now I'm relying on a couple Lynda.com tutorials but if you have any other recourses you would recommend for learning Genesis I'd be super grateful.
Thanks again! I hope you have an extra fantastic weekend!
February 13, 2015 at 12:53 pm #140729TonyaMemberYou're welcome.
The Genesis community is filled with tons of excellent resources. Typically you can do a Google search for whatever you are trying to do and most of the time someone has written a tutorial explaining how to do it. I don't want to promote one site or another here. But you'll quickly discover who has what you need.
Also if you're on Twitter, you can search for #GenesisWP and you'll find a bunch of folks who are active and sharing.
Enjoy your weekend! Cheers,
Tonya
Software & Electrical Engineer and Programming Teacher · I’m on a mission to help developers be more awesome.
Find Me: KnowTheCode.io | @hellofromTonya | Profitable WordPress Developer Bootcamp -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.