Skip to content

Instantly share code, notes, and snippets.

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

Jeremy Herve jeherve

🚀
👨‍🏭
View GitHub Profile
@jeherve
jeherve / inc-signature.php
Last active December 17, 2015 23:59 — forked from georgestephanis/inc-author-box.php
Include your signature before Jetpack's sharing buttons
<?php
/**
* When hooked to either the_content or the_excerpt filters,
* this should append the signature before the Jetpack sharing buttons
* are added, so long as the priority is 18 or less!
* (as Jetpack's sharing options go in at priority 19)
*
* @param string $content The post content as passed to the function
* @returns string The content with the author box appended to it.
@jeherve
jeherve / tweakjp_disable_spin.php
Created June 5, 2013 15:45
Disable Jetpack's spinner function when it conflicts with Mootools' spinner. Careful though, it will break all features using the Spinner: Carousel, Custom CSS, Infinite Scroll, Notes http://i.wpne.ws/PRX9
<?php
/*
* Plugin Name: Disable Jetpack's Spinner
* Plugin URI: http://wordpress.org/extend/plugins/
* Description: Disable Jetpack's Spinner
* Author: George Stephanis
* Version: 1.0
* Author URI: http://stephanis.info/
* License: GPL2+
*/
@jeherve
jeherve / functions.php
Created June 7, 2013 15:32
[Jetpack] Remove Comment form from Carousel View. It will also remove the comment from all Attachment pages.
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 );
@jeherve
jeherve / functions.php
Created June 24, 2013 17:33
Customize the Post info in the Genesis Framework, to add the Jetpack sharing buttons
<?php
//* Do NOT include the opening php tag
/** Delete the default Jetpack sharing buttons */
function jeherve_remove_share() {
if ( function_exists( 'sharing_display' ) )
remove_filter( 'the_content', 'sharing_display', 19 );
remove_filter( 'the_excerpt', 'sharing_display', 19 );
}
add_action( 'init', 'jeherve_remove_share' );
@jeherve
jeherve / functions.php
Last active December 18, 2015 22:49
Add an additional wrapper around your posts in the Genesis framework
<?php
//* Do NOT include the opening php tag
add_action( 'genesis_before_loop', 'jh_open_wrapper' );
add_action( 'genesis_after_loop', 'jh_close_wrapper' );
function jh_open_wrapper() { ?>
<div id="jh_posts">
<?php }
@jeherve
jeherve / functions.php
Last active December 19, 2015 19:49
Check if a post includes a Gallery, and include a X-UA-Compatible to the head
<?php
function jeherve_check_galleries( $post ) {
global $post;
if ( false !== strpos( $post->post_content, '[gallery' ) )
echo '<meta http-equiv="X-UA-Compatible" content="IE=8" />';
}
add_action( 'wp_head', 'jeherve_check_galleries' );
@jeherve
jeherve / functions.php
Last active October 10, 2016 13:48
[Jetpack] Customize the contents of the "Older Posts" text appearing when activating Infinite Scroll.
<?php
function jeherve_custom_infinite_more() {
if ( is_home() || is_archive() ) {
?>
<script type="text/javascript">
//<![CDATA[
infiniteScroll.settings.text = "Custom Text";
//]]>
</script>
@jeherve
jeherve / plugin.php
Created August 17, 2013 18:31
[Jetpack] Remove Jetpack Sharing buttons in the Mobile Theme
<?php
// Check if we are on mobile
function jetpackme_is_mobile() {
// Are Jetpack Mobile functions available?
if ( ! function_exists( 'jetpack_is_mobile' ) )
return false;
// Is Mobile theme showing?
if ( isset( $_COOKIE['akm_mobile'] ) && $_COOKIE['akm_mobile'] == 'false' )
@jeherve
jeherve / plugin.php
Created August 17, 2013 18:32
[Jetpack] Shortcodes: how to remove specific shortcodes
<?php
add_filter( 'jetpack_shortcodes_to_include', 'my_remove_shortcode_function' );
function my_remove_shortcode_function( $shortcodes ) {
$jetpack_shortcodes_dir = WP_CONTENT_DIR . '/plugins/jetpack/modules/shortcodes/';
$shortcodes_to_unload = array( 'ted.php', 'soundcloud.php', );
foreach ( $shortcodes_to_unload as $shortcode ) {
if ( $key = array_search( $jetpack_shortcodes_dir . $shortcode, $shortcodes ) ) {
@jeherve
jeherve / plugin.php
Created August 17, 2013 18:33
[Jetpack] Use photon to serve Post thumbnails, with custom cropping, and a different cropping on single pages:
<?php
if( function_exists( 'jetpack_photon_url' ) ) {
add_filter( 'jetpack_photon_url', 'jetpack_photon_url', 10, 3 );
}
function jeherve_display_custom( $content, $post ) {
global $post;
// If you didn't define a post thumnail, let's forget about all this
if ( !has_post_thumbnail( $post->ID ) )