-
Notifications
You must be signed in to change notification settings - Fork 800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Twitter cards: add new jetpack_twitter_image_default filter #8664
Twitter cards: add new jetpack_twitter_image_default filter #8664
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution!
This seems like a good idea. I've just added a few comments of things that could be improved in my opinion.
class.jetpack-twitter-cards.php
Outdated
/** | ||
* Filter the default Twitter card image, used when no image can be found in a post. | ||
* | ||
* @since 5.8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've passed the code freeze period for 5.8.0. Could you update this to 5.9.0
?
@@ -36,6 +36,18 @@ static function twitter_cards_tags( $og_tags ) { | |||
} | |||
|
|||
if ( ! is_singular() || ! empty( $og_tags['twitter:card'] ) ) { | |||
/** | |||
* Filter the default Twitter card image, used when no image can be found in a post. | |||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add @module sharedaddy
here, so our codex parser can pick the filter up?
class.jetpack-twitter-cards.php
Outdated
* | ||
* @param string $str Default image URL. | ||
*/ | ||
$image = apply_filters( 'jetpack_twitter_image_default', '' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about changing the filter name to jetpack_twitter_cards_image_default
to match other filters in that file?
7b940f5
to
5f2eff3
Compare
thanks for the review! all those sound good; all done. |
Matches existing `jetpack_open_graph_image_default` filter.
5f2eff3
to
024a7b4
Compare
I've just updated the testing snippet in the PR description because the filter name was not the same one introduced by the code. Correct one is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and works great!
woo, thanks all! |
* update changelog.txt * Update readme.txt with scaffolding for 5.9 changelog and release draft shortlink * Add changelog entry for #8243 * Add changelog entry for #8296 * Add changelog entry for #8367 * Add changelog entry for #8686 * Add changelog entry for #8707 * Add changelog entry for #8709 and #8714 * Add changelog entry for #8729 * Add changelog entry for #8777 * Add changelog entry for #8780 * Add changelog entry for #8786 * Add changelog entry for #8787 * Add changelog entry for #8801 #8805 #8832 #8865 and #8804 * Add changelog entry for #8817 * Add changelog entry for #8822 * Add changelog entry for #8823 * Add changelog entry for #8829 * Add changelog entry for #8834 * move some items to major enhancements * Add changelog entry for #8836 * Add changelog entry for #8839 * Add changelog entry for #8861 * Add changelog entry for #8862 * Add changelog entry for #8863 * Add changelog entry for #8866 * Add changelog entry for #8870 * Add changelog entry for #8874 * Add changelog entry for #8875 * Add changelog entry for #8881 * Add changelog entry for #8890 * Add changelog entry for #8911 * Add changelog entry for #8927 * Add changelog entry for #8931 * Add changelog entry for #8933 * Add changelog entry for #8930 * fix wording * typo * minor fixes * replace partner scripts for Jetpack Start in changelog entry * Update to-test.md * Update to-test.md * minor style fixes to to-test.md * minor style fixes to to-test.md * minor fixes on to-test.md * Add changelog entry for #8868 * Add changelog entry for #8844 * Add changelog entry for #8664 * Add changelog entry for #8935 * Add changelog entry for #8425 * Add changelog entry for #8625
Twitter cards: add new
jetpack_twitter_image_default
filter to allow themes and plugins to customize twitter:image when no suitable image is found automatically. It matches the existingjetpack_open_graph_image_default
filter.(Thanks for considering this!)
To test, add this to your theme's
functions.php
:Fetch your site's home page, and a post page that wouldn't otherwise have a Twitter image set. Verify that they both now include
<meta name="twitter:image" content="http://asdf.com/89asdf.gif" />
.Proposed changelog entry: