Community Forums › Forums › Archived Forums › General Discussion › Genesis Footer Before Wrap
- This topic has 5 replies, 3 voices, and was last updated 10 years, 6 months ago by
Tony @ AlphaBlossom.
-
AuthorPosts
-
July 12, 2014 at 12:13 pm #114043
Joseph Lee
MemberDoes anyone know how to hook in to the genesis .site-footer div above the .wrap.
Genesis layout:
<footer class="site-footer">
<--- I want to go here --->
<div class="wrap">
Footer stuff.
</div></footer>
add_action( 'genesis_footer', 'celestial_custom_footer', 5 ); puts me inside of the wrap, 4 puts me above the .site-footer.
This happens a lot. I can't get between a div and it's wrap. It's really frustrating. Perhaps I don't understand something?
July 12, 2014 at 3:40 pm #114067Tony @ AlphaBlossom
MemberThere's no hook between the opening div and the wrapper div. There is a "genesis_attr_structural-wrap" filter that maybe you could work to do what you want, but I didn't have time to try that out.
I'm not sure if this is the best way to handle it, so maybe someone else can jump in with their thoughts, but you can unhook the existing "genesis_footer_markup_open" and rehook it with your new div added before the wrap:
remove_action( 'genesis_footer', 'genesis_footer_markup_open', 5 ); add_action( 'genesis_footer', 'new_genesis_footer_markup_open', 5 ); /** * Echo the opening div tag for the footer. * * Also optionally adds wrapping div opening tag. * * @since 1.2.0 * * @uses genesis_structural_wrap() Maybe add opening .wrap div tag with footer context. * @uses genesis_markup() Apply contextual markup. */ function new_genesis_footer_markup_open() { $prewrapdiv = '<div class="newdiv">New Content</div>'; genesis_markup( array( 'html5' => '<footer %s>', 'xhtml' => '<div id="footer" class="footer">', 'context' => 'site-footer', ) ); echo $prewrapdiv; genesis_structural_wrap( 'footer', 'open' ); }
That adds your new content before the wrap tag.
Hope that helps!
Tony
Tony Eppright | http://www.AlphaBlossom.com | Follow me on twitter @_alphablossom
July 14, 2014 at 6:29 pm #114320Gary Jones
MemberTony's solution is probably the best suggestion here.
genesis_attr_* won't work, as that's for attributes, not tags.
What has been turned on in Genesis 2.1 is
genesis_structural_wrap-{$context}
. Sogenesis_structural_wrap-footer
is the filter hook that you can use to amend the opening and closing markup using two filters, with the second argument on the filter being able to tell which context is happening.
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
July 14, 2014 at 6:55 pm #114327Tony @ AlphaBlossom
MemberHi Gary,
Thanks for the clarification...I was looking at that filter as well but didn't get a chance to look into it much. I'll have to have a look, sounds very helpful!
Take care,
Tony
Tony Eppright | http://www.AlphaBlossom.com | Follow me on twitter @_alphablossom
July 14, 2014 at 9:54 pm #114348Joseph Lee
MemberWhere can I find documentation on filters?
I don't know why this exists if no one knows! 🙂
July 14, 2014 at 10:10 pm #114350Tony @ AlphaBlossom
MemberStart digging through the Genesis core files...they're very well documented.
Also recommend Gary's ebook http://gamajo.com/store, great resource!
Tony Eppright | http://www.AlphaBlossom.com | Follow me on twitter @_alphablossom
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.