• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Basic Hooks Question — Adding custom HTML

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Basic Hooks Question — Adding custom HTML

This topic is: not resolved

Tagged: add html

  • This topic has 7 replies, 4 voices, and was last updated 10 years, 8 months ago by Brad Dalton.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • March 30, 2013 at 8:06 pm #32172
    Gr8_Eight
    Member

    Hi,

    1. Is there any disadvantage to using the simple hooks plugin?  E.g. If I use it wIth  child theme ,will I have a problem when the main genesis theme updates?

    2. Plugins aside, I'm trying to understand hooks by hand. My goal is to simply add the text (for example)

    <p>click here</p> to the 'genesis_before_header' area of the genesis sample theme.

    I've done a lot of reading and I simply can't find the answer.

    In funcitons.php if I start with:

    add_action('genesis_before_header' --where do I go from here?

    <p>click here</p>

    Thank you  in advance!

    March 30, 2013 at 10:22 pm #32188
    Peter
    Member

    Hi

     

    you should have no probs using the plugin and updates to gegenesis particularly as you're just putting in HTML as you say.

    to use this kind of

    add_action(‘genesis_before_header’ –where do I go from here?

    You need to write php code and create a function etc... If you're not sure about this, the simple hook is the way to go!

     

    Peter


    === WordPress producer @ thedma.com.au ===

    March 31, 2013 at 3:43 am #32213
    Anita
    Keymaster

    On the "click here" I am assuming you are wanting to have it link to somewhere, correct? And do you want to add this so it shows up on every page of the site or on specific pages/posts?


    Love coffee, chocolate and my Bella!

    March 31, 2013 at 3:45 am #32214
    Anita
    Keymaster

    Also, have you read this - http://my.studiopress.com/docs/hooks/.


    Love coffee, chocolate and my Bella!

    March 31, 2013 at 4:01 am #32218
    Brad Dalton
    Participant

    I think the Simple Hooks plugin is an excellent stepping stone to understanding hooks and thier locations.

    However i think at some stage you'll move on to custom functions once you understand how hooks works and the different locations they execute.

    Using your child themes functions.php file is better than using Simple hooks because all your custom coding is contained in one file which is easier to manage.

    Here's a very basic example of a custom function you can modify and use over and over again simply by changing the hook, div class for styling and unique name of the function.

    This enables you to easily display HTML or text in any genesis_hook location the same way Simple Hooks works but from your child themes functions.php file.

    https://gist.github.com/braddalton/5180457

    If you simply add text or HTML to a Simple Hooks field, you don't get to target it with a class for styling unless you also add the class in the field as well.


    Tutorials for StudioPress Themes.

    March 31, 2013 at 4:07 am #32220
    Anita
    Keymaster

    So then Brad, would you be able to answer this hook question I posted over here a few minutes ago?


    Love coffee, chocolate and my Bella!

    March 31, 2013 at 5:39 pm #32361
    Gr8_Eight
    Member

    Thanks, Brad. This is EXACTLY what I was looking for!

     

     

    April 1, 2013 at 9:13 am #32438
    Brad Dalton
    Participant

    I've also been writing alot about using hooks in custom functions with over 100 code snippets which you might find helpful.


    Tutorials for StudioPress Themes.

  • Author
    Posts
Viewing 8 posts - 1 through 8 (of 8 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble