Community Forums › Forums › Archived Forums › General Discussion › Create Generic Override of Custom Genesis Function/Variables via Plugin
- This topic has 4 replies, 2 voices, and was last updated 11 years, 9 months ago by
Derek.
-
AuthorPosts
-
June 20, 2013 at 6:23 pm #46973
Derek
MemberI realize this may be way out of the scope of help, but someone might be able to give me a better answer than anything I've been able to find online.
I've been putting together a plugin that allows me to modify elements of the Comment Form on a post-by-post basis. The WP core uses the "comment_form_defaults" function to handle the fields in the comment form. My code simply replaces this function with a new one.
add_filter( 'comment_form_defaults', 'custom_comment_form_variables' ); function custom_comment_form_variables( $arg ) { }
This works fine on a WP install using a theme such as Twenty Twelve, but the Genesis framework replaces the "comment_form_defaults" function with it's own "genesis_comment_form_args" function. To make my code work isn't difficult, I just have to unhook the "genesis_comment_form_args" function and then re-hook it with my new variables.
remove_filter( 'genesis_comment_form_args', 'custom_comment_form_args' ); add_filter( 'genesis_comment_form_args', 'custom_comment_form_variables' ); function custom_comment_form_variables( $arg ) { }
But I'm wondering if there is a way to override (or bypass the need to unhook) the Genesis function via a more generic method, without having to specifically address the "genesis_comment_form_args" function (if that makes sense). Essentially, I want to be able to use this code/plugin on any site, regardless of parent framework or existing functions.
I'll admit I'm probably in a little over my head on this, but any insight on the topic would be greatly appreciated. Thanks!
Derek Rippe – CSS Artist & Genesis Fanboy @ SynaVista and MediaCairn Design Studio
Figure out your CSS problems with Firebug | Check out my Custom Comment Form Title pluginJune 21, 2013 at 11:09 am #47061Brad Dalton
ParticipantI'd try tweeting this using the #genesiswp hashtag. That's where all the Genesis Developers connect. You might need to write a post about it on your blog.
June 21, 2013 at 11:15 am #47062Derek
MemberThanks Brad. I'll see who I can connect with via Twitter.
Derek Rippe – CSS Artist & Genesis Fanboy @ SynaVista and MediaCairn Design Studio
Figure out your CSS problems with Firebug | Check out my Custom Comment Form Title pluginJune 21, 2013 at 11:19 am #47065Brad Dalton
ParticipantThere is also a blog post on Yoast related to this which you may find useful.http://yoast.com/standard-wordpress-theme-hooks/
June 21, 2013 at 11:39 am #47068Derek
MemberIndeed. And Yoast isn't the only one pushing for it: https://github.com/zamoose/themehookalliance
It further confirms my suspicion that, at this point, there is no "generic" method for overriding WP hooks that have already been unhooked and/or replaced/modified with a custom function.
Ultimately, I'd love to have this plugin I'm developing be available to everyone via the WordPress Plugin Directory, which is why I'm looking for a simple way to accommodate all themes/frameworks. In the meantime, I may just need to setup an admin page that requires the user to select their Framework and apply the appropriate code accordingly.
Derek Rippe – CSS Artist & Genesis Fanboy @ SynaVista and MediaCairn Design Studio
Figure out your CSS problems with Firebug | Check out my Custom Comment Form Title plugin -
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.