ideag / content-cards

A WordPress plugin to display links as "cards" based on OpenGraph information
https://wordpress.org/plugins/content-cards
30 stars 6 forks source link

=== Content Cards ===

Contributors: ideag, khromov Tags: opengraph, open graph, oembed, link cards, snippet, rich snippet, content card Donate link: http://arunas.co#coffee Requires at least: 4.1.0 Tested up to: 4.9 Stable tag: 0.9.7 License: GPLv2 License URI: http://www.gnu.org/licenses/gpl-2.0.html

Embed any link from the web easily as a beautiful Content Card.

== 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:

== Frequently Asked Questions ==

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

= 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:

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():

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;
});

== Installation ==

== Screenshots ==

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

== Changelog ==

= 0.9.7 =

= 0.9.6 =

= 0.9.5 =

= 0.9.4 =

= 0.9.3 =

= 0.9.2 =

= 0.9.1 =

= 0.9.0 =