Jetpack

How to remove the comment form from Carousel View

Sometimes, you may not want your readers to comment on single images. If that’s the case, you can deactivate comments on all attachment pages and in the Carousel view by adding this code snippet to your theme’s functions.php file:

function tweakjp_rm_comments_att( $open, $post_id ) {
    $post = get_post( $post_id );
    if( $post->post_type == 'attachment' ) {
        return false;
    }
    return $open;
}
add_filter( 'comments_open', 'tweakjp_rm_comments_att', 10 , 2 );
Posted in Code snippets, Tips & Tricks | Tagged | Comments Off

Adding reCaptcha to the Email Sharing Button

How do I add reCaptcha to the Email button

The Email button is great, and you can make it even better by adding a Captcha to the submission form:

reCaptcha for Jetpack

To add the Captcha to your site, follow these steps:

  1. Start by registering on this site. Upon registration, you will receive a Public and a Private key.
  2. Open your site’s wp-config.php file in your favorite text editor, and add the following constants with both reCaptcha keys right before /* That's all, stop editing! Happy blogging. */:
    define( 'RECAPTCHA_PUBLIC_KEY', 'XXXXXXX' );
    define( 'RECAPTCHA_PRIVATE_KEY', 'XXXXXXX' );
    
  3. Voila! Your email sharing buttons are now protected against spammers!
Posted in Code snippets, Tips & Tricks | Tagged , , , | 1 Comment

How to remove stylsheets added by Tiled Galleries and Carousel

If you wish to use your own stylesheets instead of the ones that are automatically added to the posts where you’ve inserted a Tiled Gallery, or a gallery using Carousel, you can add the following code to your theme’s functions.php file, or to a functionality plugin.

To remove Tiled Galleries’s stylesheet:

function tweakjp_rm_tiledcss(){
    wp_dequeue_style( 'tiled-gallery' );
}
add_action( 'wp_footer', 'tweakjp_rm_tiledcss' );

To remove Carousel’s stylesheet:

function changejp_dequeue_styles() {
    wp_dequeue_style( 'jetpack-carousel' );
}
add_action( 'post_gallery', 'changejp_dequeue_styles', 1001 );
Posted in Code snippets, Tips & Tricks | Tagged , , , , | Comments Off

Enable Infinite Scroll in your theme using Masonry

To enable Infinite Scroll in your theme, you can follow the steps described here. However, if your theme uses the Masonry library you’ll need a few extra steps. Luckily, WPTheming put together a great tutorial:
Jetpack Infinite Scroll + Masonry

Posted in Code snippets, Tips & Tricks | Tagged , , , | Comments Off

How to change the credit link in the Infinite Scroll footer

If you’d like to change the default credit link appearing in the Infinite Scroll footer, you can use the infinite_scroll_credit filter, like so:

function tweakjp_cust_credit() {
	return '<a href="http://example.com">My Custom Link</a>';
}
add_filter( 'infinite_scroll_credit', 'tweakjp_cust_credit' );

Once you add that code to your theme’s functions.php, a new link will appear instead of the default “Powered by WordPress” link.

Posted in Code snippets, Tips & Tricks | Tagged , , | Comments Off
Follow

Get every new post delivered to your Inbox.

Join 63,476 other followers