Skip to content

Instantly share code, notes, and snippets.

View jeherve's full-sized avatar
🚀
👨‍🏭

Jeremy Herve jeherve

🚀
👨‍🏭
View GitHub Profile
@jeherve
jeherve / plugin.php
Created December 9, 2013 13:26
[Jetpack] Force deactivate all modules but stats
<?php
// Force deactivate all Jetpack modules, except for stats
function jeherve_force_deactivate_everything_but_stats() {
if ( class_exists( 'Jetpack_Options' ) )
Jetpack_Options::update_option( 'active_modules', array_unique( array( 'stats' ) ) );
}
add_action( 'init', 'jeherve_force_deactivate_everything_but_stats' );
@jeherve
jeherve / plugin.php
Created December 2, 2013 19:26
[Jetpack] Jetpack's Development mode, to replace plugins like Slim Jetpack
<?php
add_filter( 'jetpack_development_mode', '__return_true' );
<?php
/**
* When hooked to either the_content or the_excerpt filters,
* this should append the contents of the `author-box.php`
* file in your theme before the Jetpack ShareDaddy contents
* is added, so long as the priority is 18 or less!
* (as ShareDaddy's sharing options go in at priority 19)
*
* @param string $content The post content as passed to the function
@jeherve
jeherve / plugin.php
Created October 22, 2013 14:26
[Jetpack] Remove Twitter Meta cards
<?php
function jeherve_remove_tw_tags() {
remove_filter( 'jetpack_open_graph_tags', 'wpcom_twitter_cards_tags' );
remove_filter( 'jetpack_open_graph_tags', 'change_twitter_site_param' );
}
add_action( 'template_redirect', 'jeherve_remove_tw_tags' );
@jeherve
jeherve / plugin.php
Last active April 8, 2016 00:47
[Jetpack] Add a default fallback image if no image can be found in a post
<?php
/*
* Plugin Name: Jetpack default image
* Plugin URI: http://wordpress.org/extend/plugins/
* Description: Add a default fallback image if no image can be found in a post
* Author: Jeremy Herve
* Version: 1.0
* Author URI: http://jeremyherve.com
* License: GPL2+
*/
@jeherve
jeherve / plugin.php
Last active March 25, 2016 14:34
[Jetpack] Exclude certain categories from Jetpack Subscriptions
<?php
/*
* Plugin Name: Exclude the asmodeus category from Jetpack Subscriptions
* Plugin URI: http://wordpress.org/plugins/jetpack/
* Description: Exclude the asmodeus category from Jetpack Subscriptions
* Author: Jeremy Herve
* Version: 1.0
* Author URI: http://jeremyherve.com
* License: GPL2+
*/
@jeherve
jeherve / widget-visibility-tweaks.php
Last active December 23, 2015 15:08 — forked from georgestephanis/gplus-authorship-tweaks.php
[Jetpack] Do not automatically activate the Widget Visibility module
<?php
// To disable the auto-activation of Jetpack's Widget Visibility module:
add_filter( 'jetpack_get_default_modules', 'disable_jetpack_widget_visibility_autoactivate' );
function disable_jetpack_widget_visibility_autoactivate( $modules ) {
return array_diff( $modules, array( 'widget-visibility' ) );
}
// Or, to disable the functionality in your own plugin if the user activates it in Jetpack:
@jeherve
jeherve / jp-single-thumb.php
Created September 19, 2013 14:14
[Jetpack] Mobile Theme Featured images on single views too
<?php
/*
* Plugin Name: Mobile Theme Featured images on single views too
* Plugin URI: http://wordpress.org/extend/plugins/jetpack-mobile-theme-featured-images/
* Description: Adds Featured Images before the content on the article pages, in Jetpack Mobile theme
* Author: Jeremy Herve
* Version: 1.0
* Author URI: http://jeremyherve.com
* License: GPL2+
* Text Domain: jetpack
@jeherve
jeherve / plugin.php
Created August 17, 2013 18:34
[Jetpack] Add a default Image Open Graph tag only on the home page (because Jetpack doesn’t add an image tag on the home page)
<?php
function fb_home_image() {
$fb_home_img = 'YOUR_IMAGE_URL';
$fb_home_img_output = sprintf( '<meta property="og:image" content="%s" />', esc_attr( $fb_home_img ) );
if ( is_home() )
echo $fb_home_img_output;
}
add_action( 'wp_head', 'fb_home_image' );
@jeherve
jeherve / style.css
Created August 17, 2013 18:33
[Jetpack] Carousel: move the close icon to the right
.jp-carousel-close-hint { right: 100px!important; }
body .jp-carousel-close-hint span { float: right; font-size: 60px!important; width: 60px; height: 60px; }