Tagged: add html
March 30, 2013 at 8:06 pm #32172
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?
Thank you in advance!March 30, 2013 at 10:22 pm #32188
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!
=== WordPress producer @ thedma.com.au ===March 31, 2013 at 3:43 am #32213
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?March 31, 2013 at 3:45 am #32214March 31, 2013 at 4:01 am #32218
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.
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.
Brad Dalton has written 1910 tutorials & 4000+ Code Snippets for Genesis & WordPress – Not For Hire.March 31, 2013 at 4:07 am #32220
So then Brad, would you be able to answer this hook question I posted over here a few minutes ago?March 31, 2013 at 5:39 pm #32361
Thanks, Brad. This is EXACTLY what I was looking for!April 1, 2013 at 9:13 am #32438
I've also been writing alot about using hooks in custom functions with over 100 code snippets which you might find helpful.
Brad Dalton has written 1910 tutorials & 4000+ Code Snippets for Genesis & WordPress – Not For Hire.
You must be logged in to reply to this topic.