I having trouble with the Card Validator;


#1

Hi

I having trouble with the Card Validator;
It gives below
ERROR: Required meta tag missing (twitter:description)

i use below code ,error comes everywhere except home page

if(is_single() || is_page()) {

 $twitter_url    = get_permalink();

 $twitter_title  = get_the_title();

 $twitter_desc   = get_the_excerpt();

   $twitter_thumbs = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), full );

    $twitter_thumb  = $twitter_thumbs[0];

      if(!$twitter_thumb) {

      $twitter_thumb = 'http://share-ask.com/wp-content/uploads/popular-debate-topics-for-high-school-students.jpg';

    }

  $twitter_name   = str_replace('@', '', get_the_author_meta('twitter'));

?>

<meta name="twitter:card" value="summary_large_image" />

<meta name="twitter:url" value="<?php echo $twitter_url; ?>" />

<meta name="twitter:title" value="<?php echo $twitter_title; ?>" />

<meta name="twitter:description" value="<?php echo $twitter_desc; ?>" />

<meta name="twitter:image" value="<?php echo $twitter_thumb; ?>" />

<meta name="twitter:site" value="@shareask" />

<?

  if($twitter_name) {

?>

<meta name="twitter:creator" value="@<?php echo $twitter_name; ?>" />

<?

  }

}

?>

#2

If the error is telling you the twitter:description tag is missing, then I can only assume that the call to get_the_excerpt(); is returning a null or blank value on most of your site’s pages.


#3

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.