Create Generic Override of Custom Genesis Function/Variables via Plugin

Community Forums Forums General Discussion Create Generic Override of Custom Genesis Function/Variables via Plugin

This topic is: not resolved

This topic contains 4 replies, has 2 voices, and was last updated by  Derek 1 year, 1 month ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #46973

    Derek
    Participant
    Post count: 46

    I 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 plugin

    #47061

    braddalton
    Participant
    Post count: 8849

    I’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.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #47062

    Derek
    Participant
    Post count: 46

    Thanks 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 plugin

    #47065

    braddalton
    Participant
    Post count: 8849

    There is also a blog post on Yoast related to this which you may find useful.http://yoast.com/standard-wordpress-theme-hooks/


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #47068

    Derek
    Participant
    Post count: 46

    Indeed. 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

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.