Skip to content

Instantly share code, notes, and snippets.

@kraftbj
kraftbj / functions.php
Created November 5, 2020 21:03
Remove cache test from AMP
<?php
add_filter( 'site_status_tests', function ( $tests ) {
unset( $tests['direct']['amp_persistent_object_cache'] );
return $tests;
}, 99 );
@kraftbj
kraftbj / functions.php
Last active October 7, 2019 20:11
Reset Jetpack Protect Local Trusted IP Setting
<?php
function jetpack_support_reset_protect_ip() {
delete_site_option('trusted_ip_header');
}
add_action( 'admin_head', 'jetpack_support_reset_protect_ip');
@kraftbj
kraftbj / functions.php
Created June 14, 2018 21:16
Akismet filter privact notice
add_filter( 'akismet_comment_form_privacy_notice_markup', 'bk_custom_akismet_markup' );
function bk_custom_akismet_markup( $markup ) {
$markup = '<p class="akismet_comment_form_privacy_notice">' . sprintf(
__( 'This site uses Akismet to reduce spam. <a href="%s" target="_blank" rel="nofollow">Learn how your comment data is processed</a>.', 'akismet' ),
'https://akismet.com/privacy/'
) . '</p>';
return $markup;
}
<?php
/*
Plugin Name: Jetpack - Disable Slideshow
Plugin URI: https://jetpack.com
Description: Disable Jetpack's slideshow feature
Author URI:
Version: 2017.07.24
License: GPL
*/
@kraftbj
kraftbj / functions.php
Created June 23, 2017 19:17
Publicize for Resumes
<?php // do not include in an existing file
add_action('init', 'kraft_wpjmresume_publicize');
function kraft_wpjmresume_publicize() {
add_post_type_support( 'resume', 'publicize' );
}
@kraftbj
kraftbj / jetpack-ads-posts-only.php
Last active April 11, 2017 15:17
Only display Jetpack Ads on posts
<?php // Remove this line if copy/pasting to an existing file.
/*
Plugin Name: Only Display Jetpack Ads on Posts
Plugin URI: https://kraft.blog
Description: Only output Jetpack Ads on posts and no other post type.
Author: Kraft
Author URI: https://kraft.im/
Version: 2016.06.15
License: GPL
*/
<?php // Remove this in an existing functions.php file
add_filter( 'job_manager_indeed_get_jobs_args', 'custom_job_manager_indeed_get_jobs_args' );
function custom_job_manager_indeed_get_jobs_args( $args ) {
$args['sort'] = 'date';
return $args;
}
@kraftbj
kraftbj / openpgp.txt
Created November 21, 2016 02:33
OpenKeychain Linked Identity
This Gist confirms the Linked Identity in my OpenPGP key, and links it to this GitHub account.
Token for proof:
[Verifying my OpenPGP key: openpgp4fpr:b17b814a12d5c8fb83411dbcbe9093a329011676]
@kraftbj
kraftbj / functions.php
Last active November 3, 2016 22:25
Change jetpack to 10min
<?php //remove in an existing file
add_filter( 'cron_schedules', 'jp_support_sync_schedule' );
function jp_support_sync_schedule( $schedules ) {
if ( ! isset( $schedules['10min'] ) ) {
$schedules['10min'] = array(
'interval' => 10 * MINUTE_IN_SECONDS,
'display' => __( 'Every 10 minutes' ),
);
}
return $schedules;
@kraftbj
kraftbj / functions.php
Created October 31, 2016 15:42
Stop application details from hiding
<?php // Do not include this line
add_action( 'wp_head', 'bk_unhide_app_details' );
function bk_unhide_app_details(){ ?>
<script type="text/javascript">
jQuery(window).load( function() {
jQuery( '.application_details' ).show();
jQuery( '.application_button' ).click(function() {
});
});