Skip to content

Instantly share code, notes, and snippets.

Phil Wylie mustardBees

Block or report user

Report or block mustardBees

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
@mustardBees
mustardBees / functions.php
Last active Aug 29, 2015
Hook into Gravity Forms after form submission in order to save latitude/longitude in the format expected by the CMB Field Type: Google Maps plugin.
View functions.php
<?php
/**
* Save latitude/longitude for display in a CMB field
*
* @author Phil Wylie
* @link http://link.from.pw/1ejMnDr
*/
function pw_save_latitude_longitude( $entry, $form ) {
$latitude = $entry[3]; // where 3 is the field ID for latitude
$longitude = $entry[4]; // where 4 is the field ID for longitude
@mustardBees
mustardBees / functions.php
Created Jun 4, 2014
WordPress login page tweaks
View functions.php
<?php
/**
* Filter the logo on the WordPress login page
*/
function iweb_login_logo(){
echo '<style type="text/css">h1 a {background-image:url(' . get_stylesheet_directory_uri() . '/logo.png' . ') !important; background-position: center center !important; background-size: auto !important; width: 265px !important; height: 80px !important;}</style>';
}
add_filter( 'login_head', 'iweb_login_logo' );
/**
View functions.php
<?php
/**
* Prevent Yoast SEO redirect 302 instead 404 on date archives
*
* @author Henry Ruhl
* @link http://goo.gl/s5d0Lo
*/
function iweb_remove_pagination_overflow_redirect() {
remove_action( 'wp', array($GLOBALS['wpseo_front'], 'pagination_overflow_redirect'), 99 );
}
View functions.php
<?php
/**
* Gets a number of terms and displays them as options
*
* Modified from CMB example code to save the term ID instead of slug.
*
* @link http://link.from.pw/1sLyqqv
* @param string $taxonomy Taxonomy terms to retrieve. Default is category
* @param string|array $args Optional. Change the defaults retrieving terms
* @return array An array of options that matches the CMB options array
@mustardBees
mustardBees / functions.php
Created Aug 18, 2014
Remove text colour button from editor
View functions.php
<?php
/**
* Remove text colour button from editor
*/
function iweb_remove_text_colour_button( $buttons ) {
if ( ( $key = array_search( 'forecolor', $buttons ) ) !== false ) {
unset( $buttons[$key] );
}
return $buttons;
@mustardBees
mustardBees / iweb_simple_post_list.php
Created Oct 14, 2014
WordPress Simple Post List Plugin
View iweb_simple_post_list.php
<?php
/*
Plugin Name: Simple Post List
Plugin URI: http://www.iwebcontrol.co.uk/
Description: Simple plugin to output a list of blog post URLs.
Version: 1.0.0
Author: Phil Wylie
Author URI: http://www.iwebcontrol.co.uk/
License: GPLv2+
*/
@mustardBees
mustardBees / functions.php
Last active Aug 29, 2015
WordPress - get the slug of your post or page
View functions.php
<?php
/**
* Get the slug of your post or page
*
* @author Tom Barrett
* @link http://goo.gl/95boK0
*/
function iweb_get_the_slug( $id = null ) {
if ( empty( $id ) ) {
global $post;
@mustardBees
mustardBees / functions.php
Created Feb 9, 2015
Generic function to return an array of posts formatted for CMB2. Simply pass in your WP_Query arguments and get back a beautifully formatted CMB2 options array.
View functions.php
<?php
/**
* Get a list of posts
*
* Generic function to return an array of posts formatted for CMB2. Simply pass
* in your WP_Query arguments and get back a beautifully formatted CMB2 options
* array.
*
* @param array $query_args WP_Query arguments
* @return array CMB2 options array
@mustardBees
mustardBees / .gitignore
Created Feb 19, 2015
Sample WordPress gitignore file
View .gitignore
# OS or IDE folders/files to ignore
*~
._*
*.lock
*.DS_Store
*.swp
*.out
.cache
.project
.settings
@mustardBees
mustardBees / functions.php
Created Apr 13, 2015
Enable Jetpack Photon on HTTPS
View functions.php
<?php
/**
* Enable Jetpack Photon on HTTPS
*
* @author Jeremy Herve
* @link http://goo.gl/inSy5i
*/
add_filter( 'jetpack_photon_reject_https', '__return_false' );
You can’t perform that action at this time.