Twitter card issue with my site

Hi,

I've been unable to get twitter cards working with my site - either with SEO Yoast nor with Twitter Cards Meta plugin. When I went to Twitter's Card Validator I get 'Unable to render Card Preview'. In the info section it shows the following:

INFO: Page fetched successfully
INFO: 20 metatags were found
INFO: twitter:card = summary tag found
WARN: Not whitelisted

So I decided to add the code directly in a child theme I have using this walkthrough. This is the code I added in my functions.php file:

add_action('wp_head', 'add_twitter_cards');

function add_twitter_cards() {
    if(is_single()) {
        $tc_url    = get_permalink();
    $tc_title  = get_the_title();
    $tc_description   = get_the_excerpt();
    $tc_image = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), full );
    $tc_image_thumb  = $tc_image[0];
    $tc_author   = str_replace('@', '', get_the_author_meta('twitter'));
?>
    <meta name="twitter:card" value="summary"/>
    <meta name="twitter:site" value=“@david_hammy” />
    <meta name="twitter:title" value="<?php echo $tc_title; ?>" />
    <meta name="twitter:description" value="<?php echo $tc_description; ?>" />
    <meta name="twitter:url" value="<?php echo $tc_url; ?>" />
        <?php if($tc_image) { ?>
      <meta name="twitter:image" value="<?php echo $tc_image_thumb; ?>" />
        <?php } if($tc_author) { ?>
        <meta name="twitter:creator" value="@<?php echo $tc_author; ?>" />
<?
    }
    }
}

I still get the same result in the Twitter validation page and when I send for approval Twitter responses with the following:

The URL you provided for .... to use the summary card did not validate. Please make sure the page contains valid metadata, then reapply for a Twitter card.

Any thoughts would be much appreciated! This is my site. and you can check the meta data in the header.

  • Michael Bissett
    • Recruit

    Hey @David, hope you're doing well this evening! :slight_smile:

    This might be more in Twitter's camp, but I'm curious, did you try using the Twitter Cards Meta plugin on your site, with all other plugins disabled, and the theme set to one of the default themes (e.g. Twenty Fifteen)?

    Another thing I'm curious about is, how is the robots.txt (usually found in the root of your site, accessible via FTP) set up presently?

    Please advise,
    Michael

  • David
    • Design Lord, Child of Thor

    I didn't try with all plugin disabled and the default theme. Let me try that in a second. In the meantime this is my site's robot.txt

    User-agent: *
    Crawl-delay: 1
    Disallow: /wp-content/plugins/
    Disallow: /wp-admin/

  • David
    • Design Lord, Child of Thor

    Ok still nothing with yoast seo plugin and twentyfifteen. When i have no plugins but with the child theme I get the 'unable to render card preview' and the following:

    INFO: Page fetched successfully
    INFO: 24 metatags were found
    INFO: twitter:card = summary tag found

  • Michael Bissett
    • Recruit

    Hey @David, my apologies for the extreme delay here!

    When i have no plugins but with the child theme I get the 'unable to render card preview' and the following

    I'm curious, are you trying to submit a http:// URL or a a https:// URL? What is the URL that you're trying to submit anyhow?

    Another thing I'm curious about. Over in our article about Twitter cards:

    https://premium.wpmudev.org/blog/twitter-cards-wordpress/

    We mention the JM Twitter Cards plugin, have you had a look at that yet? I'd personally want to try that, and having only that plugin active (with the Twenty Fourteen theme in use, just to be safe).

    I see that they've got a video tutorial over here on how it can be used:

    http://www.youtube.com/watch?v=8l4k3zrD4Z0#t=33

    Let me know if I can be of further assistance here please! :slight_smile:

    Kind Regards,
    Michael

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.