Skip to content

Instantly share code, notes, and snippets.

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

Jeremy Herve jeherve

🚀
👨‍🏭
View GitHub Profile
@jeherve
jeherve / jp_restrict_rp.php
Last active February 10, 2018 10:50 — forked from richardmtl/jp_restrict_rp.php
Restrict Jetpack's Related Posts to a specific time-frame
function jetpackme_related_posts_date_restricted( $date_range, $post_id ) {
// We can change this based on $post_id too but let's just filter everything
$date_range = array(
'from' => strtotime( '1 January 2013' ),
'to' => time(),
);
return $date_range;
}
add_filter( 'jetpack_relatedposts_filter_date_range', 'jetpackme_related_posts_date_restricted', 10, 2 );
<?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 / 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 / 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.