php - Twitter card on Wordpress -


step # 1 : added meta tags in header.php

<?php if (is_single()){      $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->id ) );     ?>     <meta name="twitter:card" content="summary" />     <meta name="twitter:url" content="<?php echo get_permalink() ?>" />     <meta name="twitter:title" content="<?php echo get_the_title() ?>" />     <meta name="twitter:description" content="<?php echo get_the_excerpt() ?>" />     <meta name="twitter:image" content="<?php echo $image[0] ?>" /> <?php } ?> 

step # 2 : on twitter click added

<?php     $link = empty($twitter_username) ? 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url : 'https://twitter.com/intent/tweet?text='.$title.'&amp;url='.$url. '&amp;via='.$twitter_username; ?>      <li>        <a onclick="popupcenter('<?php echo $link; ?>', 600, 300);" class="share-link" style="margin-left : <?php echo $spacebetweenicons-4?>px !important"><i class="fa fa-twitter"></i></a>    </li> 

step # 3: tweet url

step # 4 : check on card validator following logs

info: page fetched
info: 8 metatags found
info: twitter:card = summary tag found
info: card loaded

step # 5 : go twitter

on twitter see text of url on view detail ..

i dont missing please .. description in advance :)


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -