Adding content to
-
Topic
-
Jason:
How do I add content to the area? eg:
My title
Viewing 7 replies - 1 through 7 (of 7 total)
Viewing 7 replies - 1 through 7 (of 7 total)
- You must be logged in to reply to this topic.
This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.
How do I add content to the area? eg:
My title
Hmmm having trouble adding content – and getting an error when I edit…
(head>
(meta name=”google-site-verification” content=”-HjBXM8djFDaW-lUd_LoiywwlJrHyzteTUkybnUIHys” />
(title> My title
(/head>
Answering my own question – but wanted to check it with you.to be sure I did it right – still new to php
I copied header.php to my child theme and added the line below the (head)
(head>
(meta charset=”<?php bloginfo( ‘charset’ ); ?>” />
(meta name=”google-site-verification” content=”-HjBXM8djFDaW-lUd_LoiywwlJrHyzteTUkybnUIHys” />
You can put your code in <pre>
tags to have it show up in the forums.
It’s better to not copy header.php to your Child theme. You can easily accomplish what you’re trying to do with action hooks from your Child theme’s functions.php.
http://codex.wordpress.org/Plugin_API/Action_Reference/wp_head
function my_google_verification(){ echo '<meta name="google-site-verification" content="-HjBXM8djFDaW-lUd_LoiywwlJrHyzteTUkybnUIHys" />'; } add_action( 'wp_head', 'my_google_verification' );
Thank Jason – good to know the best way to do this.
To edit my 404 page is it OK to edit contents–404?
I tried <pre>
and it didn’t work for some reason.
Can I just check my understanding of this:
function my_google_verification(){ echo ''; }
this means I am creating a function called my_google_verification and that function will do “echo…”
then I hook that function to the wp-head with this:
add_action( 'wp_head', 'my_google_verification' );
wp-head has already been defined in the theme.
If I have more to add to the area should I create new functions for each and hook them in one by one?
Yes, you are correct. You’re creating your own function that outputs whatever you want, and then you’re hooking that function to an action hook that’s already established.
http://codex.wordpress.org/Function_Reference/add_action
And “wp_head” is actually a default WordPress action hook that is present in any theme you work with.
http://codex.wordpress.org/Plugin_API/Action_Reference/wp_head
If I have more to add to the area should I create new functions for each and hook them in one by one?
It doesn’t matter. Just do whatever makes the most sense, organizationally, to you.