The Beginners Guide on How to Add Twitter Cards in WordPress
  • December 28

The Beginners Guide on How to Add Twitter Cards in WordPress

Twitter Cards allow you to attach the news to your tweets that lead to your content that can be created to your website with a WordPress theme. To do this, you just need to add a few lines of HTML code in a webpage, and then the users who will tweet links to your content, you will have a Twitter Card to add to your tweet and make it visible to all subscribers to your Twitter account.

With the introduction of Twitter Cards, you can add them to the website with a WordPress theme:

  • To control the display of content in tweets;
  • To attract more traffic to the site;
  • Increase the number of your Twitter followers by reference to the source.
11_2 The biggest advantage of these cards is that people will be able to give links to your content with an indication of the source. If someone re-tweeted your message without links to your Twitter, if new interested users most likely do not subscribe to your Twitter, someone who re-tweeted without reference. This is often done to reduce the length of the message and thus to ensure retweets own messages. On Twitter Cards, this problem is solved, because you get an increase of confidence in your site with every tweet your article.

How to add a Twitter Cards to WordPress themes

  1. SEO in WordPress plugin via Yoast
Yoast plugin has built-in integration of Twitter Cards, so you can include it in just a few clicks. To do this, go to the WordPress SEO page titled as Social and see the settings. Click on Add Twitter Card Meta Data. And insert the name of your site with WordPress theme in Twiiter account.
11_3 The next thing you need to do is go to your profile - Users - My Profile. There you will see several fields for Contact Info for your username on Twitter. Enter your user name. If your site has several authors, then allow authors to customize this part of your profile. This method is the simplest.
  1. Add Twitter Cards to your WordPress template with coding
To use this option, you need to do some manipulations with the code. Open the header.php file and paste the following code before the closing tag: <? php #twitter cards hack 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://www.gravatar.com/avatar/8eb9ee80d39f13cbbad56da88ef3a6ee?rating=PG&size=75';} $ twitter_name = str_replace ('@', '', get_the_author_meta ('twitter')); ?><meta name = "twitter: card" value = "summary" /> <meta name = "twitter: url" value = "<? php echo $ twitter_url;?>" /> </ meta> <meta name = "twitter: title" value = "<? php echo $ twitter_title;?>" /> </ meta> <meta name = "twitter: description" value = "<? php echo $ twitter_desc;?>" /> </ meta> <meta name = "twitter: image" value = "<? php echo $ twitter_thumb;?>" /> </ meta> <meta name = "twitter: site" value = "<a href =" http://twitter.com/libdemvoice "target =" _ blank "rel =" nofollow "> @ libdemvoice" /> <?if ($ twitter_name) {?> </ meta> <meta name = "twitter: creator" value = "@ <? php echo $ twitter_name;?>" /> ?> </ meta> If you do not know how to work with PHP, then you should stick to the first method.
  1. The application for participation
What you have just added support for Twitter Cards to your site with a WordPress theme does not mean that they immediately begin to appear on the website Twitter. In order for the system to work, you need to apply for its activation. To do this, you need to test your site using the Preview Tool. And then complete the application form.
11_4 In this form, you do not have to provide the URL for the Photo Card or URL for Player Card. Simply enter the example URL Summery Card, which contains a sample of any article from your website built with a WordPress template. If you have any questions about Adding Twitter Cards on a website with WooCommerce theme or WordPress theme, then you can ask them on our forum or via the Technical Support.

Did you know ?

One standard license is valid only for 1 project. Running multiple projects on a single license is a copyright violation.

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.