Easy integration of Twitter cards in WordPress. All card types provided.
This is the GitHub/dev version of the JM Twitter Cards plugin.
Want to fork? Please fork the trunk version and not the master version, URL is here : https://github.com/jmau111/jm-twitter-cards/tree/trunk
To get this work:
git clone https://github.com/jmau111/jm-twitter-cards.git && cd jm-twitter-cards
If Gutenberg is enabled then run :
npm i && npm run build
or use the wordpress.org version.
You can create custom add-ons based on custom filters and other hooks available in the main plugin.
add_filter('jm_tc_image_source', function($url)
{
global $post;
if (!isset($post->post_content)) {
return $url;
}
if (preg_match_all('`<img [^>]+>`', $post->post_content, $matches)) {
$_matches = reset($matches);
foreach ($_matches as $image) {
if (preg_match('`src=(["\'])(.*?)\1`', $image, $_match)) {
return $_match[2];
}
}
}
return $url;
});
add_filter('jm_tc_image_source', function($image)
{
if (empty($image)) {
return false;
}
$params = (array) apply_filters('jm_tc_refresh_image_query_string_params', ['tc' => strtotime('now')], $image);
return add_query_arg($params, $image);
});
- October 2022
- dependency updates
- delete yarn
- February 2022
- composer updates
- get excerpt field as meta desc if it's fulfilled in post edit and no other overriding option is used
- January 2022
- update npm/composer dependencies
- new filter
jm_tc_display_html_comments
to hide HTML comments (credits) - css preview, align fields and preview on desktop to enhance the experience
- toggle details - instructions by default
- October 2021
- update npm/composer dependencies
- July 2021
- update npm dependencies
- security fixes
- new filters for sections settings
- April 2021
- fix indentation
- security fixes
- November 2020
- the plugin has now an italian version props to Chema Bescós
- fix issue reported with reusable Gutenberg blocks in edge cases
- October 2020
- add tests
- update @wordpress/scripts - fix security issues
- October 2020
- fix issue reported on support with non Gutenberg installations
- October 2020
- a missing warning on fresh install wp
- October 2020
- fix deprecations
- update sidebar gutenberg
- use the amazing core js setup
- bufixes with default values