Code in the header with a child theme?
-
I would like to add a piece of code to my header:
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>But, of course, every time I would update the theme I would have to add the code manually again. Is there a way to implement the code somewhere (child theme maybe?) so that it would also be there after an update?
Mod
The best way is to use an action in your functions.php file of your child theme. and attach it to the “wp_head()” action hook.
Can you just create an action hook in the header.php, try the
graphene_container_before.I don’t think the script will show anything, and I haven’t tested this, but give it a try and see what happens.
I’m curious 🙂
Awesome. Great to know.
Yeah, I’ve seen a lot of people having issues with the counters using various social sharing.
Glad you got it working!
ALSO: This might be a good place to store any scripts in the future that require being placed in the header. I know various add-ons require a script code in the header. Maybe this could be used like a “script tank”??
Thanks for testing!
Viewing 7 posts - 1 through 7 (of 7 total)
- You must be logged in to reply to this topic.
