Forum Replies Created
-
AuthorPosts
-
August 8, 2013 at 3:18 pm in reply to: Why you shouldn't fear updating to Genesis 2.0 [from 1.9, but should from 2.0RC2 #55093russelljMember
My add_action with an array is vapour-ware, it is just my idea of how add_action could be extended (in a world without priorities)
For example, to add your cool new stuff into the list you just add it to the array of actions as follows:
remove_all_actions( 'genesis_entry_content'); add_action( 'genesis_entry_content', array( 'genesis_do_post_image', 'genesis_do_post_content' , 'your_new_cool_stuff', 'genesis_do_post_permalink','genesis_do_post_content_nav' ));
To me this is intuitive and flexible: I want to redefine entry_content so I kill the old entry_content and define the new. This works for adding stuff, removing stuff and reordering stuff.
And if I want to change any of the elements, then I can use a filter - assuming each function has an associated filter hook where you can override its behaviour.
For example, if I want to change how the permalink is rendered, I add a filter. This assumes the last thing the genesis_do_post_permalink function does is:
return apply_filters('genesis_post_permalink', $permalink);
Genesis of course already supports this way of overriding components.
August 8, 2013 at 8:55 am in reply to: Why you shouldn't fear updating to Genesis 2.0 [from 1.9, but should from 2.0RC2 #54907russelljMemberYou make a strong argument (and I guess that means you're right).
In terms of elegance it just feels a little like we have gone back to Assembler coding or GoTo Statements, where arbitrary numbers like 9,11,12,13 mean something.
Seems I am stuck with having to remember facts that the genesis_do_post_permalink happens at 12
Maybe, when the only option left is to reclassify priority as a float, then we'll find a better way.
My preference would be using something like the following that uses explicit ordering (and no numbers)
add_actions('genesis_entry_header', array('genesis_do_post_format_image', 'genesis_entry_header_markup_open', 'genesis_do_post_title','genesis_post_info', 'genesis_entry_header_markup_close')); add_actions( 'genesis_entry_content', array( 'genesis_do_post_image', 'genesis_do_post_content' , 'genesis_do_post_permalink','genesis_do_post_content_nav' )); add_actions( 'genesis_entry_footer', array('genesis_entry_footer_markup_open', 'genesis_post_meta', 'genesis_entry_footer_markup_close'));
Obviously, this is a work in progress....
August 8, 2013 at 5:43 am in reply to: Why you shouldn't fear updating to Genesis 2.0 [from 1.9, but should from 2.0RC2 #54849russelljMemberRe: Proliferation Of Action Hook Priorities
Thanks Gary for documenting this.
I would like to propose that StudioPress look at getting rid of the action hook priorities completely and maybe add more hooks instead as this would be much cleaner and less prone to error.
<rant>
My belief is that priorities should ideally not appear in a theme framework at all. They should only be a tool for the plugin developer, or the theme designer or the end user to make tweaks - they do not belong in the core.You do not find the WordPress code itself peppered with hook priorities... Priorities should be the option of last resort due to their arbitrary nature.
</rant>But otherwise, Genesis 2.0 rocks!
I am loving HTML5 (navs, asides, sections, headers and footers and especially the new rant tag)
Check out my port of Magazine on HTML5. Using Eric Hamm's excellent XTML5 to HTML5 CSS converter it was a piece of cake.
-
AuthorPosts