• Resolved Mark

    (@stormagan)


    Customizr doesn’t have the Google Authorship Code and needs a single line added:
    <link rel=”author” href=”YOUR GOOGLE PLUS PROFILE URL”/>

    But in header.php, the entire <head> is called in this line:
    <?php
    //the ‘__before_body’ hook is used by TC_header_main::$instance->tc_head_display()
    do_action( ‘__before_body’ );
    ?>

    Where is the file in which I can place code in the <head>?

    Thanks!
    Mark

Viewing 12 replies - 1 through 12 (of 12 total)
  • Hi Mark,
    you need first to have a child theme (have a look in the WordPress documentation or do some googling, out there it’s plenty of good tutorials) and in your functions.php you just need to add this snippet:

    //Add page authorship for my web site
    add_action('wp_head', 'add_google_rel_author');
    function add_google_rel_author() {
    echo '<link rel="author" href="https://plus.google.com/blablabla" />';
    }

    Ciao!
    Nicola

    Thread Starter Mark

    (@stormagan)

    Thanks for the quick reply, Nicola.
    Is the child theme necessary? It seems as though I could add this code snippet without it, no?

    Mark

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    I think it is really worth doing a little effort to build a child theme; by the way, you just need to create a directory next to your original theme and put in it the functions.php file.

    This simple strategy will help you a lot when the Customizr team will release new updates of the theme: if you decide to update it, the WordPress update process will remove the older one and you’ll loose all your work…

    Just 3 minutes for a child theme and you won’t have headache anymore!
    Nicola

    Thread Starter Mark

    (@stormagan)

    Ok Nicola, I’ve created the child theme. I think you’re saying that I create a new functions.php file in the child theme folder and that the only code in that file is what you have above – correct?

    Mark

    Thread Starter Mark

    (@stormagan)

    I’m not seeing the authorship code in view source. Here’s exactly what I put in the functions.php file:

    <?php
    /**
    *
    * This functions.php file is ONLY for the Child Theme
    */

    //Add page authorship for my web site
    add_action(‘wp_head’, ‘add_google_rel_author’);
    function add_google_rel_author() {
    echo ‘<link rel=”author” href=”https://plus.google.com/106532785326335558821&#8243; />’;
    }

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Can you link your site?

    Thread Starter Mark

    (@stormagan)

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Clear your browser’s cache, the authorship code is there.

    Thread Starter Mark

    (@stormagan)

    Ok. Interesting. The code I added specified link rel=”author” (which is why I was searching for “author” in the source) but the source says link rel=”publisher”. Any idea why it flipped or if there is a difference to Google?

    Thread Starter Mark

    (@stormagan)

    Ahhh. The rel=publisher is coming from WordPress SEO plugin. I still don’t have rel=author code from the child functions.php showing up.

    Thread Starter Mark

    (@stormagan)

    Ok. I didn’t get it to work via the addition of that code in a functions.php in the child, but looking more closely at the WordPress SEO plugin, I made it work there. AND – added bonus – I set up my child theme so that I can now make changes to the CSS that will persist with updates to the Customizr theme. Thanks all!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Google Authorship’ is closed to new replies.