WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
[resolved] [closed] How to change settings for Twitter Cards? (10 posts)

  1. Christiaan Conover
    Member
    Posted 10 months ago #

    I noticed that Jetpack has support for Twitter Cards, which is excellent. I'd like to edit the value of twitter:site to show my Twitter handle instead of @jetpack, but don't see any way to do this. Also, all my posts show twitter:card as photo and again I don't see anywhere to change this.

    Is there a place to change these values that I just haven't found yet? If not, that definitely seems like something that should be added.

    http://wordpress.org/plugins/jetpack/

  2. ab11936
    Member
    Posted 10 months ago #

    Yes. I would prefer to use Jetpack for Twitter Cards. However I canot change the meta tags that are included in JetPack version 2.4. It appears with Jetpack 2.4 it has hard-coded Jetpack Twitter account information and it only sends it over as a Photo Twitter Card style.

    I have tried the plug in JM Twitter Cards 3.3.6 but it wants to disabled Jetpack, which I would prefer not to do. Thank you for any information you have.

  3. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 9 months ago #

    I'd like to edit the value of twitter:site to show my Twitter handle instead of @jetpack

    You can customize this value by adding the following code to your theme's functions.php file:

    function tweakjp_custom_twitter_site( $og_tags ) {
    	$og_tags['twitter:site'] = '@jeherve';
    	return $og_tags;
    }
    add_filter( 'jetpack_open_graph_tags', 'tweakjp_custom_twitter_site', 11 );

    You'll have to replace my twitter username with your own, of course :)

    all my posts show twitter:card as photo and again I don't see anywhere to change this.

    Jetpack actually looks for images into your posts:

    • If you didn't insert any image, the twitter card will be set to "summary"
    • If you insert between 1 and 4 images, the twitter card will be set to "photo"
    • if you insert more than 4 images, the twitter card will be set to "gallery"

    Of course, you'll welcome to overwrite this default behaviour by adding one more line to the previous code:

    function tweakjp_custom_twitter_site( $og_tags ) {
    	$og_tags['twitter:site'] = '@jeherve';
    	$og_tags['twitter:card'] = 'summary';
    	return $og_tags;
    }
    add_filter( 'jetpack_open_graph_tags', 'tweakjp_custom_twitter_site', 11 );

    Another solution would be to use a different Twitter Card plugin, like JM Twitter Cards as @ab11936 mentioned. You can use both Jetpack and this plugin at the same time. As soon as you activate the plugin, Jetpack's twitter cards will be deactivated, along with another related Jetpack feature: the Open graph cards used by Facebook. That means that you'd have to install another plugin, like WP Open Graph.

  4. acekin
    Member
    Posted 5 months ago #

    Jeremy, I inserted the code to the functions.php file in Genesis/Magazine Pro theme. It worked on single or archive pages but broke the home page. Needless to say, I removed the code.

    Could this not be a settable option in JetPack rather than going the route of customizing theme functions? Next time I update the theme these changes will disappear I think, right?

    Cemal

  5. Brandon Kraft
    Happiness Engineer
    Plugin Author

    Posted 5 months ago #

    We're working on making this easier to customize in a future release... code being tested and reviewed. :-)

  6. acekin
    Member
    Posted 5 months ago #

    Very good to hear, we'll wait.

    Cemal

  7. mccosha
    Member
    Posted 2 months ago #

    My twitter connection is not showing cards at all.
    jetpack is installed but I cannot make it post the Summary Large Image card and the twitter validator (https://dev.twitter.com/docs/cards/validation/validatorhttps://dev.twitter.com/docs/cards/validation/validator) gives me an "incorrect card" message every time.

    my site is http://dailyloft.com and twitter acc @dailyloft

    Thanks!

  8. Brandon Kraft
    Happiness Engineer
    Plugin Author

    Posted 2 months ago #

    Hi Mccosha,

    When using the validator, please be sure to enter a page with the card type already set.

    For example, if you validate http://dailyloft.com/2014/05/mechanisms-link-brain-alertness-increased-heart-rate-discovered/ , it will give you an option to approve the Summary Large Image card type.

    Additionally, it looks like your Yoast SEO settings are incorrect for the Twitter creator. It it outputting @https://twitter.com/dailyloft instead of just the Twitter handle.

    If you need anything else, could you please start your own thread, as per the Forum Welcome?

    http://wordpress.org/support/plugin/jetpack#postform

    Thank you!

  9. MasterC3501
    Member
    Posted 1 month ago #

    is this resolved yet??? Dont understand why the goto move for these plugin developers is changing your themes code. This is quite annoying and anything a plugin intends to FORCE the website to do should be made available to alter within the plugin's settings. Seems like everything with Jetpack has to be corrected by changing code.

  10. esmi
    Forum Moderator
    Posted 1 month ago #

    If you require assistance then, as per the Forum Welcome, please post your own topic instead of tagging onto someone else's topic.

    I am now closing this 8 month old resolved topic as it references an older version of WordPress.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic