Quantcast
Channel: Code snippets – Jetpack
Browsing all 20 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

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...

View Article


Image may be NSFW.
Clik here to view.

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...

View Article


Image may be NSFW.
Clik here to view.

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: // Check if we are on mobile function jetpackme_is_mobile() { // Are Jetpack Mobile...

View Article

Image may be NSFW.
Clik here to view.

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: function jpcarousel_auto_close_comments(...

View Article

Image may be NSFW.
Clik here to view.

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,...

View Article


Image may be NSFW.
Clik here to view.

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...

View Article

Image may be NSFW.
Clik here to view.

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...

View Article

Image may be NSFW.
Clik here to view.

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: jQuery(document).on( 'jp_carousel.selectSlide', '.jp-carousel-wrap', function(...

View Article


Image may be NSFW.
Clik here to view.

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

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....

View Article


Image may be NSFW.
Clik here to view.

How to add a default fallback image if no image can be found in a post

When you publish a new post on your site, Jetpack crawls it and looks for images that can be used when sharing that post on Facebook, on Twitter, or if that post appears in the Top Posts and Pages...

View Article

Image may be NSFW.
Clik here to view.

How to exclude a category from the Mobile Theme

If you’ve ever wanted to exclude a particular category of posts from being displayed by Jetpack’s Mobile Theme, you can use the following code in your theme’s functions.php or in a functionality...

View Article

Image may be NSFW.
Clik here to view.

Hook of the Month: Customizing the Top Posts & Pages Widget

Let’s kick off 2016 with a new series: welcome to the first installment of Hook of the Month! Hooks are places in WordPress code where you can add your own code or change the default behavior of...

View Article

Image may be NSFW.
Clik here to view.

Hook of the Month: taking control of email subscriptions

Are you familiar with Jetpack Subscriptions? This month, we’ll use filters to customize this module, and control which posts should be sent to your subscribers. Jetpack’s Subscriptions module sends an...

View Article


Image may be NSFW.
Clik here to view.

Hook of the Month: Customizing Contact Forms

Did you know you could create contact forms with Jetpack? This month, we’ll discover different ways to customize these forms on your site. Change the post-submission success message Would you like to...

View Article

Image may be NSFW.
Clik here to view.

Hook of the Month: Customizing Sharing Buttons

Jetpack’s sharing buttons look good, are simple to use, and include several hooks allowing you to customize every single aspect of the module. Let’s learn to use some of these hooks together! Remove...

View Article


Image may be NSFW.
Clik here to view.

Hook of the Month: Customize Modules, Shortcodes, and Widgets

Whether you’re a blogger, a business owner, or a developer – Jetpack comes with many different features you can use to build your site, write your posts, and promote them. However, you may not use all...

View Article

Image may be NSFW.
Clik here to view.

Announcing: developer.jetpack.com

Do you use hooks to customize Jetpack’s default behaviour? Are you a fan of our Hook of the Month series? Then you’ll love our new code reference! If you follow this blog, you already know that Jetpack...

View Article


Image may be NSFW.
Clik here to view.

Hook of the Month: Customize Related Posts

Jetpack’s Related Posts module is a simple and easy way to add contextual posts your visitors might be interested in when they reach the end of a post on your website. To use this feature, go to your...

View Article

Jetpack Hooks: Control Jetpack CDN

Note: We wrote this article with advanced users in mind; you’ll need some coding knowledge to accomplish these tasks. As always, enable Jetpack Backup so you can easily revert your site in case of a...

View Article

Image may be NSFW.
Clik here to view.

How to Add JavaScript to WordPress Pages and Posts

JavaScript is a programming language that can add interactive features to your website. Learning how to use it on your WordPress site, including specific sections, can help you leverage the code more...

View Article
Browsing all 20 articles
Browse latest View live