Skip to content

Instantly share code, notes, and snippets.

Steve Taylor gyrus

Block or report user

Report or block gyrus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@gyrus
gyrus / gfapigetentries.php
Created Jun 18, 2019
GFAPI::get_entries() 'in' operator
View gfapigetentries.php
<?php
$most_recent_subscription = GFAPI::get_entries(
[ 1, 3 ],
[
'status' => 'active',
'field_filters' => [
[
'key' => 'transaction_type',
'value' => 2,
View gform_post_render.js
jQuery( document ).bind( 'gform_post_render', function( ev, field, form ) {
console.log( ev );
});
@gyrus
gyrus / gist:3155971
Created Jul 21, 2012
WordPress custom post type taxonomy list filters
View gist:3155971
<?php
/**
* Taxonomy list filters and columns
*
* @todo Test!
* @todo Need replacement function for slt_terms_list()
* @link http://wordpress.stackexchange.com/questions/578/adding-a-taxonomy-filter-to-admin-list-for-a-custom-post-type/3215#3215
*/
add_action( 'restrict_manage_posts', 'pilau_restrict_manage_posts' );
@gyrus
gyrus / pilau-tabs.css
Created Aug 14, 2012
WordPress tabs shortcode
View pilau-tabs.css
/*
* This is the bare minimum CSS necessary to make jQuery UI tabs "work".
* Obviously you'll need to do a lot more styling to make them "good" :)
*/
.ui-tabs-hide { display: none; }
@gyrus
gyrus / preload-images.js
Last active Jun 21, 2018
WordPress image preloading
View preload-images.js
/**
* Image preloader
*
* @link http://engineeredweb.com/blog/09/12/preloading-images-jquery-and-javascript
*/
var cache = [];
// Arguments are image paths relative to the current page.
function pilau_preload_images() {
var args_len, i, cache_image;
args_len = arguments.length;
@gyrus
gyrus / shortcodes.php
Last active Jun 11, 2018
TinyMCE button for WordPress shortcode
View shortcodes.php
<?php
/**
* Skeletal sample shortcode
*/
add_shortcode( 'pilau-sample', 'pilau_sample_shortcode' );
function pilau_sample_shortcode( $atts ) {
extract( shortcode_atts( array(
'text' => ''
), $atts ) );
@gyrus
gyrus / gist:3155982
Created Jul 21, 2012
Rename WordPress "Posts" to "News"
View gist:3155982
<?php
/**
* Rename "Posts" to "News"
*
* @link http://new2wp.com/snippet/change-wordpress-posts-post-type-news/
*/
add_action( 'admin_menu', 'pilau_change_post_menu_label' );
add_action( 'init', 'pilau_change_post_object_label' );
function pilau_change_post_menu_label() {
@gyrus
gyrus / gist:3332597
Created Aug 12, 2012
Override a WordPress 404 with a specific template
View gist:3332597
<?php
/**
* Override a 404
*
* @param string $template If passed, this template will be included and
* the request will be terminated if the inclusion
* was successful
* @param string $type If not a 404, what type of request should this be
* flagged as? Must correspond to one of the
@gyrus
gyrus / gist:3157070
Created Jul 21, 2012
Get WordPress nav menu without markup containers
View gist:3157070
<?php
/**
* Get nav menu without markup containers
*
* @uses wp_nav_menu()
* @param string $menu The name given to the menu in Appearance > Menus
* @param integer $depth
* @return string
*/
@gyrus
gyrus / pilau_protocol_relative_image_urls.php
Created Apr 16, 2015
Filter images sent to editor to make the URLs protocol-relative for possible SSL
View pilau_protocol_relative_image_urls.php
<?php
add_filter( 'image_send_to_editor', 'pilau_protocol_relative_image_urls', 999999 );
/**
* Filter images sent to editor to make the URLs protocol-relative for possible SSL
*/
function pilau_protocol_relative_image_urls( $html ) {
// Replace protocols with relative schema
$html = str_replace( array( 'http://', 'https://' ), '//', $html );
You can’t perform that action at this time.