Skip to content

Instantly share code, notes, and snippets.

Ryan Duff ryanduff

Block or report user

Report or block ryanduff

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
@ryanduff
ryanduff / wp-custom-title-cpt-screen.php
Created Feb 7, 2012 — forked from rachelbaker/wp-custom-title-cpt-screen.php
WordPress Custom Title for Custom Post Type Screen
View wp-custom-title-cpt-screen.php
<?php
add_filter( 'enter_title_here', 'custom_editor_titles' );
function custom_editor_titles( $title ){
global $wp_post_types;
$screen = get_current_screen();
$post_type = $screen->post_type;
$labels = $wp_post_types[$post_type]->labels;
$label = strtolower( $labels->singular_name );
@ryanduff
ryanduff / gist:1793128
Created Feb 10, 2012
Remove Links from admin menu and admin bar's add new menu
View gist:1793128
<?php
//Removes Link item from the admin menu
add_action( 'admin_menu', 'admin_menu_render' );
function admin_menu_render() {
remove_menu_page('link-manager.php');
}
//Removes Link item from the admin bar's add new menu
@ryanduff
ryanduff / gist:1840816
Created Feb 16, 2012
Formula for Better Code
View gist:1840816
<?php
while ( have_captain_morgan() ) {
captain_morgan();
write_better_code();
}
?>
@ryanduff
ryanduff / gist:1847599
Created Feb 16, 2012
Display template file being used
View gist:1847599
add_action('wp_head', 'show_template');
function show_template() {
global $template;
print_r($template);
}
@ryanduff
ryanduff / gist:1847611
Created Feb 16, 2012
Even better way to display template file being used
View gist:1847611
add_action( 'wp_footer', 'show_template' );
function show_template() {
global $template, $wp_admin_bar;
$title = ( isset( $template ) ) ? str_replace( get_template_directory(), '', $template ) : '?';
get_currentuserinfo();
if ( !is_user_logged_in() )
return;
if ( is_admin_bar_showing() )
$wp_admin_bar->add_node( array(
@ryanduff
ryanduff / gist:2136881
Created Mar 20, 2012
Remove WooCommerce CSS from shop page
View gist:2136881
<?php
add_action( 'pre_get_posts', 'rcd_exclude_css_from_shop' );
function rcd_exclude_css_from_shop( $query ) {
if( is_post_type_archive( 'product' ) ) {
define('WOOCOMMERCE_USE_CSS', false);
}
}
?>
View gist:2347327
<?php
/**
Template Name: Author Page
*/
get_header(); ?>
<div id="container">
<div id="content" class="page">
View gist:2701204
<?php
//Results returned as either:
Array
(
[30871652] => ryan@fusionized.com
[30871649] => ryan@fusionized.com
[30871648] => ryan@fusionized.com
[30871651] => ryan@fusionized.com
View gist:2774767
<?php
//How does this:
$yesterday = date( 'Y-m-d H:i:s', strtotime( 'yesterday' ) );
$today = date( 'Y-m-d H:i:s', strtotime( 'midnight' ) );
$payload .= "Date range: $yesterday - $today \n\n";
View gist:2785147
<?php
$yesterday = date( 'Y-m-d H:i:s', strtotime( 'yesterday' ) );
$today = date( 'Y-m-d H:i:s', strtotime( 'midnight' ) );
echo "Date range: $yesterday - $today";
You can’t perform that action at this time.