• To use Twitter’s Card feature I am informed to add the following piece of code to the HEAD section of my Page that relates to that Page so Twitter can collect the data for the timeline:-

    <meta name=”twitter:card” content=”summary”>

    Where is that HEAD section, (is it in my Admin panel?) to add it and whereabouts in that HEAD section do you add it?

    I am working on a child theme of Aqua

    Ian

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter ianbrownmedia

    (@ianbrownmedia)

    Thought I should add that this has to be page specific for twitter and not site wide, if that makes sense? The piece of html has to be associated with a particular page on my site.

    You will need to locate the correct template file used in your theme to generate the <head> tag for that particular page.

    Generally WordPress themes just use a single header.php file to generate a global, site-wide <head> and meta content.

    That being said, you can use PHP coding and if() loops to insert this particular meta tag in the <head> for a specific page.

    Thread Starter ianbrownmedia

    (@ianbrownmedia)

    Hi bemdesign, I am extremely grateful for your input on this challenge.

    If it is not a pain in the proverbial for you can you explain how I use the PHP coding solution? How do I create the code and where do I put the code created.

    Please do not concern yourself with this if you would rather not get into all that, I will understand, it is just a mystery to me…LOL

    First I’ll assume you know how to create and use child themes. Create a child theme

    Next, copy the header.php file from the “parent” theme into your child theme folder.

    Then open the header.php file in your text/code editor.

    In between the opening and closing <head> tag, insert the following:

    <?php
      if (is_page('name of page or ID')) :
        echo('<meta name=\"twitter:card\" content=\"summary\">');
    ?>

    Save and apply your child theme.

    There may be a better solution but I think this should work.

    Thread Starter ianbrownmedia

    (@ianbrownmedia)

    Thank you, yes using chil theme, oddly it already has the header.php in it for some reason. I shall try this and see if it breaks the site, or not…LOL.

    Many thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Add HTML to Page HEAD’ is closed to new replies.