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.

Adding content to

  • Creator
    Topic
  • #3299
    sharonq
    Participant

    Jason:

    How do I add content to the area? eg:

    My title

Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #3300
    sharonq
    Participant

    How do I add content to the area? eg:

    My title
    • This reply was modified 7 years, 10 months ago by sharonq.
    • This reply was modified 7 years, 10 months ago by Jason Bobich.
    #3302
    sharonq
    Participant

    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>

    #3303
    sharonq
    Participant

    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” />

    #3323
    Jason Bobich
    Keymaster

    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' );
    #3357
    sharonq
    Participant

    Thank Jason – good to know the best way to do this.

    To edit my 404 page is it OK to edit contents–404?

    #3358
    sharonq
    Participant

    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?

    #3369
    Jason Bobich
    Keymaster

    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.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.