This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'rest_dispatch_request', 'map_legacy_parameters', 10, 2 ); | |
function map_legacy_parameters( $response, $request ) { | |
$request->set_param( 'per_page' , $request->get_param( 'limit' ) ); | |
return $response; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gga_set_featured_image_from_url($post_id, $url) { | |
$temp_file = download_url( $url ); | |
if (is_wp_error( $temp_file )) | |
return $temp_file; | |
$file_array['name'] = basename( $url ); | |
$file_array['tmp_name'] = $temp_file; | |
$sideloaded_id = media_handle_sideload( $file_array, $post_id ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function state_list() { | |
return array( | |
'AL' => 'Alabama', | |
'AK' => 'Alaska', | |
'AZ' => 'Arizona', | |
'AR' => 'Arkansas', | |
'CA' => 'California', | |
'CO' => 'Colorado', | |
'CT' => 'Connecticut', | |
'DE' => 'Delaware', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// can be run inside of an admin_init hook | |
global $pagenow; | |
global $plugin_page; | |
add_action('load-' . get_plugin_page_hook($plugin_page, $pagenow), 'my_function' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function array_insert($array, $values, $offset) { | |
// http://stackoverflow.com/questions/1783089/array-splice-for-associative-arrays/11114956#11114956 | |
return array_slice($array, 0, $offset, true) + $values + array_slice($array, $offset, NULL, true); | |
} | |
function admin_columns($columns) { | |
// this is the 'manage_edit-{post-type}_columns' filter | |
// add_filter( 'manage_edit-' . self::$post_type . '_columns', array($this, 'admin_columns'), 10, 1 ) ; | |
$columns = array_insert($columns, array('sales-channel' => 'Sales Channel'), 2); | |
return $columns; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: GGA - git branches | |
Description: Dashboard Widget | |
Author: Pete Nelson | |
Version: 1.0 | |
*/ | |
if (!defined( 'ABSPATH' )) exit('restricted access'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'wp_handle_upload_prefilter', 'gga_filter_large_image_dimensions' ); | |
function gga_filter_large_image_dimensions( $file ) { | |
$maxsize = 2000; | |
if ( false !== strpos($file['type'], 'image/') ) { | |
$size = getimagesize( $file['tmp_name'] ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ( function_exists( 'add_shortcode' ) && ! function_exists( 'add_shortcake' ) ) { | |
// tasty WordPress add_shortcode alias, for @technosailor | |
function add_shortcake( $tag, $func ) { | |
add_shortcode( $tag, $func ); | |
} | |
} |
OlderNewer