Content Cards

Description

Content Cards make ordinary web links great by making it possible to embed a beautiful Content Card to link to any web site.

By using OpenGraph data, Content Cards grabs the title, description and associated image to the links you embed – it’s similar to how you can embed other websites, such as YouTube, Twitter, SoundCloud and more.

For individual links, You can insert a Content Card via shortcode [contentcards url="http://yoursite.com/article-1"]. If you often use Content Cards for some website, you can register the domain name (for example: yoursite.com) as an oEmbed provider via Plugin’s Settings page and then it will behave the same way other oEmbed providers do – you will just have to paste plaintext link to a separate paragraph an Content Card will be generated automatically.

This plugin was built by Arūnas Liuiza and Stanislav Khromov. It is being developed on GitHub. If you have any questions, issues, need support, or want to contribute, please let us know here.

We are machines that convert coffee into code, so feel free to buy us a cup. Or two. Or ten.

Also, please check out our other plugins:

Screenshots

  • A Content Card embedded in post content
  • Content-cards are fully integrated with the visual editor
  • The dialog to insert Content Cards shortcode into post content
  • The Content Cards settings page
  • The Content Cards appearance on the official "Twenty" family of WordPress themes

Installation

  • Go to your admin area and select Plugins -> Add new from the menu.
  • Search for “Content Cards”.
  • Click install.
  • Click activate.

FAQ

There are two ways of inserting Content Cards into WordPress posts – shortcode and oEmbed.

Installation Instructions
  • Go to your admin area and select Plugins -> Add new from the menu.
  • Search for “Content Cards”.
  • Click install.
  • Click activate.
Shortcode

Shortcode is the simplest way – You just put [contentcards url="http://yourdomain.com/article/1"] into your post content and it gets replaced with a content card.
The shortcode accepts two attributes:

  • url (requried) – link to the site you want to display Content Card for.
  • target (optional) – if you want force links to open in new tab, use target="_blank" the same you would in actual links. This overrides the global option in Content Cards Settings page.

You can also insert the shortcode via a button in your visual editor. Start by pressing the Content Cards icon in WordPress visual editor’s (TinyMCE) toolbar. If no other plugins are adding their buttons, our button should be the last one in the top toolbar.

oEmbed

If You find that you are adding a lot of Content Cards from some single domain, You can save yourself some work, by white-listing that website as oEmbed provider in Content Card Settings page.

White-listed sites work the same way any other oEmbed provider in WordPress (YouTube, Twitter, SoundCloud, etc.) – You just need to put a plaintext link in a separate line in the WordPress editor and it will be replaced with a Content Card.

In Content Cards Settings page you can provide a list of white-listed sites. Put only domain name (example.com), one domain per line.

Skins

Content Cards come with two default skins – Default and Default Dark – created by Stanislav Khromov. These skins are designed to provide minimal structural styling and blend in nicely with active theme by inheriting the font from the theme.

All skin template files can be found in content-cards/skins/* directory and they can be overwritten by providing the same template in active theme. For example, if you want to overwrite Content Cards stylesheet, You should add content-cards.css to Your theme directory.

Main skin template is content-cards.php. If no other skin templates are defined, Content Cards will fall back to this one, the same way WordPress falls back to index.php. If you want more granular templates, you can provide content-cards-{$type}.php templates, (content-cards-website.php, content-cards-article.php, etc.). $type is based on og:type meta data provided by website.

Content Cards provides five new template tags: get_cc_data(), the_cc_data() and the_cc_target():

  • get_cc_data( $key, $sanitize = false )returns $key OpenGraph data field (i.e. ‘title’, ‘description’, etc.). If valid $sanitize function is provided, the data is escaped using it.
  • the_cc_data( $key, $sanitize = false ) – according to WordPress tradition, it prints the same data that get_cc_data() would return.
  • the_cc_target() – a special helper function, that prints target="_blank" to links if needed (according to plugin/shortcode settings). Usage: <a href=""<?php the_cc_target() ?>>.
  • get_cc_image( $size, $sanitize = false )new in v0.9.1 – returns a link to image if there is one. Defaults to image, cached in Media Library, then to remote image. For cached images, you can use $size parameter to get specific WordPress image size.
  • the_cc_image( $size, $attrs = array() )new in v0.9.1 – prints an image tag. Uses get_cc_images().
  • the_cc_css_classes( $classes )new in v0.9.4 – a filterable template tag to print out CSS classes for the main div of Content Card. Custom CSS classes can also be passed via class attribute in the shortcode

Also since v0.9.1 you can use 'favicon' key in get_cc_data()/the_cc_data() to display favicon if the remote site provides one.

Adding CSS classes to the content card container

Filter Adding a class is easy thanks to the content_cards_css_classes filter.

add_filter('content_cards_css_classes', function($classes) {
    $classes[] = 'my_class';
    return $classes;
});

Shortcode You can also add custom CSS classes on card-by-card basis using class attribute in the shortcode:

[contentcards url="http://arunas.co" class="my_class"]
Requirements

This plugin requires WP_Cron to be in proper working order.

Override the default options

If you are running this plugin on a multisite, you may wish to set site-wide settings and disable the Content Cards settings page on each separate blog.

To do this, you can use the content_cards_options hook, like this:

add_filter('content_cards_options', function($data) {

    //Disable admin page
    $data['enable_admin_page'] = false;

    return $data;
});

You can also override a number of other options using this hook. For example, here we set the theme to “default-dark”:

add_filter('content_cards_options', function($data) {

    //Disable admin page
    $data['skin'] = 'default-dark';

    return $data;
});

Reviews

Works great

Worked great

I checked my media library, no issue with cached images as previously reported

MASSIVE creation of unwanted images!

This plugin is a great idea but a complete disaster in implementation and I really don’t understand how it can still be available at WP repository!

If you are using it, please check your /uploads/ folder.

This plugin will create literally TONS of images of every link you insert in your page and will ENDLESSLY generate copies of copies of copies… of the same images at your server.

You will end up with a huge amount of storage on your server.

Please read this 4 months old support ticket before installing it:
https://wordpress.org/support/topic/cache-settings-creating-massive-image-duplicates/

Clean and easy

This plugin is light and well made.
Grabs content from linked site with title, abstract and image.
You can configure it in a simple way but you can also add you own styles if you wanna get into it.
Authors are available if you need help (and if you ask your question in the right way).

Would be a 5 star program if bugs are fixed.

I absolutely love this plugin and I can’t find any other plugin that allows me to show links like content cards does. Your plugin is pretty much essential for my website to be what i want it to be, but with your plugin installed it creates a lot of errors. Your plugin works wonderfully in beaver builder if you just add it to a text box, but if you try to add it to a post on the dashboard it wont load and brings up errors like 404 and 500. The other really sad thing is that your plugin doesn’t allow me to enter text in the visual editor of other plugins. I deactivated every other plugin on my site to be sure it was your plugin and unfortunately it was. I’m really hoping by writing this review you might be able to look into some of these errors and fix them. I really don’t want to give up on this awesome plugin please help.

*Because of the prompt and friendly response from the plugin author I am bumping my review from a three star to a four star.*

Read all 11 reviews

Contributors & Developers

“Content Cards” is open source software. The following people have contributed to this plugin.

Contributors

Translate “Content Cards” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.

Changelog

0.9.6

  • add textdomain
  • fix [] not supported on strings error

0.9.5

  • improved handling of non UTF-8 encoded websites

0.9.4

  • bugfix – WordPress 4.4 breaks relative requires/includes, so converted them to absolute ones
  • enhanced OpenGrahp image detection – uses first image if more than one is available
  • cached images are now removed on plugin deactivation/removal
  • added a toggle to disable local image caching

0.9.3

  • bugfix ‘undefined’ download_url() function.
  • bugfix force_absolute_url() method to work correctly with protocol-agnostic (//domain.com) URIs.
  • enhanced favicon detection mechanism.

0.9.2

  • fixes a bug where wp-admin became unaccessible due to ‘undefined’ get_current_screen() function

0.9.1

  • New feature – Content Card images are now cached in Media Library.
  • Added 'favicon' key to display site icon.
  • Content Cards’ max-width limited to 600px via CSS.
  • Added an option to limit how many words should be displayed in 'description'.
  • Fixed a bug where non absolute URIs were provided for favicon and/or image in OG:data
  • Added an icon for TinyMCE editor button.
  • Shortcode loading screen now is configurable via Skins.

0.9.0

  • initial release to WordPress.org