Community Forums › Forums › Archived Forums › Design Tips and Tricks › After Entry Widget
Tagged: after entry widget, Executive Pro Theme
- This topic has 5 replies, 2 voices, and was last updated 9 years, 10 months ago by Victor Font.
-
AuthorPosts
-
March 16, 2015 at 1:48 pm #144661brettatkinMember
I'm using the Executive Pro Theme.
What is this doing:
//* 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 );I believe the 5 changes its location.
Where is it moving it to?
Thanks
Brett
http://fcr.betaforming.com/March 16, 2015 at 8:49 pm #144694Victor FontModeratorNo. The 5 is the load priority. The "genesis_after_entry" is the location. Where do you want to move the widget area to?
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?March 17, 2015 at 3:50 am #144705brettatkinMemberI'm don't want to move it, I'm just curious. Shouldn't anything tied to the "genesis_after_entry" always be after the entry?
I'm looking at this and wondering how moving it does anything. Isn't is always going to be after the genesis_entry_footer and before the genesis_after_endwhile?
The SP documentation says "This hook executes after each entry in all loop blocks".
So, in the code example, where was the widget going to get displayed before the change and where is it getting displayed now?
Is there any guide or documentation that explains the load priority? From what I've read, it is all relative and you have to use a bit of trial and error to reposition things. I've only used priority to reposition my theme stylesheet to come after various plugin stylesheets and I just kept picking an higher number (I believe 10 is the default) until it was at the end.
Thanks for responding.
March 17, 2015 at 7:03 am #144724Victor FontModeratorThe documentation for add_action is in the WordPress codex. It is not a Genesis function. http://codex.wordpress.org/Function_Reference/add_action
Load priority has nothing to do with position. It determines the priority in which functions load. For example, if you want function B to load before function A, you would adjust the load priority.
The first parameter in the add_action call is the hook. It is the hook that determined where a function loads. For example, if you wanted the After Entry widget area to the space before the header, you would use
add_action( ‘genesis_before_header’, ‘genesis_after_entry_widget_area’, 5 );.
Keep in mind, this is still just the widget area. You still need to add widgets to the widget area before you'll get anything to display.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?March 18, 2015 at 5:37 am #144818brettatkinMemberOkay, I think I got it. Priority determines the loading order of functions within that hook.
add_action( ‘genesis_before_header’, ‘genesis_after_entry_widget_area’, 5 );
Even though the above is possible, that seems like lazy coding isn't it - loading something in the header that was intended to be after the post?
Thanks
March 18, 2015 at 8:13 am #144831Victor FontModeratorBrett, that was only an example to illustrate the hook function. It's not lazy coding at all. Regardless of what a developer names a widget area, it's still a widget area and can be loaded anyplace you'd like the widget area to appear.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet? -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.