Support » Plugin: Jetpack - WP Security, Backup, Speed, & Growth » How to update Twitter Cards meta?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    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 🙂

    Thread Starter plake777

    (@plake777)

    Perfect, worked great. Thank you!

    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

    Plugin Contributor Richard Archambault

    (@richardmtl)

    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.

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

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

    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?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    @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!

    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.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    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.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘How to update Twitter Cards meta?’ is closed to new replies.