functions.php code and Genesis Simple Hooks

Community Forums Forums General Discussion functions.php code and Genesis Simple Hooks

This topic is: resolved

This topic contains 2 replies, has 2 voices, and was last updated by  eduardomachuca 1 year, 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #29473

    eduardomachuca
    Participant
    Post count: 6

    I remembered a question I always forget to ask. When someone says “just copy the following code into your theme’s functions.php file”, if I’m using the Genesis Simple Hooks plugin, where exactly should I copy it instead? And do I need to enable the Execute PHP on this hook option?

    I’m currently adding code to the functions.php file on the Modern Portfolio theme, but wonder if that code would disappear during a future theme upgrade. Thus, I’d rather use the genesis simple hooks.

    Gracias,

    Eduardo


    Eduardo Machuca

    #29480

    nickthegeek
    Keymaster
    Post count: 756

    Eduardo,

    It really depends on the code. Not all code can go into the Genesis Simple Hooks plugin. If it is supposed to do something in admin it will not work. If it is an action that adds some functionality to the front end of the site, you may just need a part of it. For example:
    [php]
    add_action( ‘genesis_before_content’, ‘child_before_content’ );
    function child_before_content() {
    echo ‘This is before the #content div';
    }
    [/php]
    You could put this into the genesis_before_content hook in the Genesis Simple Hooks plugin
    [php]
    <?php echo ‘This is before the #content div'; ?>
    [/php]
    It will do the same thing. Then again, since I’m just outputting HTML there you could just add this too
    [html]
    This is before the #content div
    [/html]

    Ultimately it is something that would have to be modified a bit on a per instance case though, not something that can be covered with “add this to ‘x’ hook and you will be fine every time.”

    #29483

    eduardomachuca
    Participant
    Post count: 6

    Clarified. Thanks for your prompt answer!


    Eduardo Machuca

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

You must be logged in to reply to this topic.