WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
[resolved] How to update Twitter Cards meta? (10 posts)

  1. plake777
    Member
    Posted 11 months ago #

    The latest 2.4 version added Twitter Cards meta tags to OpenGraph. How do you update the twitter:site meta tag?

    It currently is set to @jetpack???

    <meta name="twitter:site" content="@jetpack" />

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

  2. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 11 months ago #

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

  3. plake777
    Member
    Posted 11 months ago #

    Perfect, worked great. Thank you!

  4. techsou
    Member
    Posted 10 months ago #

    I have same problem i put this code :

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

    In function of the theme, When i put it i can't enter to my wp-admin !!!

    Please help

  5. Richard Archambault
    Happiness Engineer
    Plugin Author

    Posted 10 months ago #

    Techsou, try copying the code out by hand (not copy paste) in your theme's functions.php file. Sometimes an errant space or tab character gets copied by copy-paste and can cause issues.

    Let me know if you still have problems with it.

  6. techsou
    Member
    Posted 9 months ago #

    Same Problem, But when i use Twitter Card Meta Plugin it's working fine !

    http://wordpress.org/plugins/twitter-cards-meta/

  7. Cris Henderson
    Member
    Posted 8 months ago #

    personally i think it is absolutely RIDICULOUS that it forces @jetpack by default, especially without an easily added textbox to modify---

    should never just drop @jetpack by default. all i did was download and install jetpack and BOOM, @jetpack is loaded.

    how is this acceptable?

  8. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 8 months ago #

    @Cris If you're not happy with the default value, and if you don't feel comfortable editing PHP code, you can install another Twitter Card plugin, as @techsou mentioned earlier. As soon as you install another Twitter Card plugin, the Jetpack Twitter Cards will disappear and let the other plugin handle things.

    I agree though, @jetpack might not be the best choice for everyone. We're continuously working on improving Jetpack, and we're thinking on ways to let you customize this value without having to touch code.

    Thanks for the feedback!

  9. Cris Henderson
    Member
    Posted 8 months ago #

    i guess what i'm trying to say (and correct me if i'm wrong), is that i should be able to turn off portions (and all) of the extra stuff added to the code, such as the OpenGraph tags.

    I'm pretty new to Jetpack, but have used it a bit. I went through the modules and didn't fine one _specific_ option to disable the twitter meta cards, for example.

    By just looking at your example code I can see that I will probably be able to maybe unset some opengraph tags, and viola.

    However, it should be easily disabled via the gui so I don't have to add a custom plugin or modify my theme to support jetpack in that aspect.

  10. Jeremy Herve
    Happiness Engineer
    Plugin Author

    Posted 8 months ago #

    By just looking at your example code I can see that I will probably be able to maybe unset some opengraph tags, and viola.

    You can indeed use a filter to disable Twitter Cards, like so:

    add_filter( 'jetpack_disable_twitter_cards', '__return_true', 99 );

    However, it should be easily disabled via the gui so I don't have to add a custom plugin or modify my theme to support jetpack in that aspect.

    We try to stick to WordPress' core principles and philosophy as much as possible. That's why we sometimes decide to make a decision for the majority of the users, instead of adding one more option. We do however, do our best to provide filters so people can change the default behaviour with an extra plugin, or a few lines of code in their theme's functions.php file.

Reply

You must log in to post.

About this Plugin

About this Topic