Thema

Developers

  • Ever accidentally publicize a post that you didn’t mean to?

    Note: Publicize is now auto-share and is part of Jetpack Social. Ever accidentally publicize a post that you didn’t mean to? This snippet will prevent the connections from being auto-selected, so you need to manually select them if you’d like to publicize something. You can place this code snippet in your theme’s functions.php file, or…

  • How to add JavaScript events to the Carousel view

    Add this to your site’s js to enable events such as adding Google Analytics tracking code to individual Carousel slides: You can read more about it here.

  • How to disable the auto-activation of a Jetpack module

    In Jetpack 2.6, we will introduce a new filter, jetpack_get_default_modules. It will allow you to stop the auto-activation of a specific Jetpack module. Here is an example with the Widget Visibility module: Reference. If you wanted all Jetpack modules to be deactivated by default, you could use the following code:

  • How to load only a specific Jetpack module

    Sometimes you do not want to see a specific module in the Jetpack menu. You might not use it at all, or you might want to make sure other admins can’t activate it. For such cases, you can use the jetpack_get_available_modules filter to control the list of modules available in Jetpack. Load only a specific…

  • How to change the size of the thumbnails in the Top Posts widget

    The Top Posts widget offers different options to display a list of posts, or a grid of post thumbnails. In some cases, you might want to change the size of the thumbnails used by this widget. To do so, you’ll need to change the size parameters in the image source, by adding the following code…

  • Automatically close comments in the Carousel view

    You can use the following code to automatically close comments in the Carousel view, based on the number of days you’ve defined in Settings > Discussion:

  • Make Sure Your Functions Function: Unit Testing

    Hopefully you’ve checked out our new contributor guide and you’re ready to submit your first patch — thanks! But before you send your .diff out into the world, run a unit test to make sure everything’s working as it should.

  • Remove Jetpack Sharing buttons in the Mobile Theme

    You can add the following code to a functionality plugin to remove the Jetpack Sharing buttons in the Mobile Theme: Looking for more mobile tips? You’ll find them here!

  • How to disable specific shortcodes in Jetpack

    Jetpack includes many shortcodes allowing you to embed videos, audio files, images, and other media into your posts. If you want to deactivate a specific shortcode without deactivating the Shortcodes module, you can add the following code to a functionality plugin. Please note that this will not work in a theme’s functions.php file due to the…

  • How to use Photon to serve custom cropped Post thumbnails

    The Photon module resizes your site’s images on the fly, without cropping them. However, in some cases you might want Photon to apply a custom cropping when resizing certain images. In the following example, we will use photon to serve Post thumbnails with custom cropping, and use a different cropping on single pages: Reference