Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Timothy Wood codearachnid

🎯
Focusing
View GitHub Profile
@codearachnid
codearachnid / tribe-view-helpers.class.php
Created Apr 12, 2012
Tri.be Event Calendar getMonthOptions bugfix
View tribe-view-helpers.class.php
<?php
/**
* The issue is in lib/tribe-view-helpers.class.php and exists in the getMonthOptions function.
* The date that is passed in by default "2012-04-01-01" has an extra '-01' appended to it.
* I am unsure where this is getting added to the date, but adding str_replace( '01-01', '01', $date )
* to remove those extra characters fixes the output.
*/
/**
@codearachnid
codearachnid / extend_wp_widget_factory.php
Created Apr 21, 2012
Extend the WP_Widget_Factory class by overloading the register method to allow for passing params
View extend_wp_widget_factory.php
<?php
/*
*
* Extends the WP_Widget_Factory class by overloading the register method to allow for passing params
*
*/
Class Extend_WP_Widget_Factory extends WP_Widget_Factory {
@codearachnid
codearachnid / get_all_posts_cpt.php
Created May 8, 2012
Wordpress: get all posts (or limit) from/by custom post type
View get_all_posts_cpt.php
function get_all_posts_cpt( $request ) {
if( $request['post_type'] == 'distribution')
$request['posts_per_page'] = -1;
return $request;
}
add_filter( 'request', 'get_all_posts_cpt' );
View plugin-user-taxonomies-save-profile.php
<?php
/**
* Save the custom user taxonomies when saving a users profile
*
* @param Integer $user_id - The ID of the user to update
*/
public function save_profile($user_id) {
foreach(self::$taxonomies as $key => $taxonomy) {
// Check the current user can edit this user and assign terms for this taxonomy
@codearachnid
codearachnid / notice_date_default_timezone_override.php
Created Aug 3, 2012
Notify admin user of a manual override of the default UTC timezone setting in WordPress.
View notice_date_default_timezone_override.php
<?php
// Notify admin user of a manual override of the default UTC timezone setting in WordPress.
// more details: http://goo.gl/7iqVY
if( date_default_timezone_get() != 'UTC' ) {
add_action('admin_notices', 'notice_date_default_timezone_override');
}
function notice_date_default_timezone_override(){
echo '<div class="error"><p>You have a manual override of the default <b>UTC</b> timezone to <b>' . date_default_timezone_get() . '</b> enabled on your install, this will potentially cause conflicts with plugins relying on the default WordPress configuration.</p></div>';
}
@codearachnid
codearachnid / events-calendar-pro.php
Created Aug 17, 2012
Bugfix: Tri.be The Event Calendar PRO (or community) will not show draft/pending venues or organizers CPT in the dropdown. Replace the provided methods in the appropriate files to resolve.
View events-calendar-pro.php
<?php
// This code is being introduced in TEC PRO v2.0.9
// events-premium/events-calendar-pro.php
/**
* helper function for displaying the saved venue dropdown
*
* @since 2.0
* @param mixed $current the current saved venue
* @param string $name the name value for the field
@codearachnid
codearachnid / map_canvas.css
Created Aug 17, 2012
Bugfix: Google Maps popup overlay conflicts with Bootstrap CSS and other CSS that resets max-width on certain dom tags
View map_canvas.css
/**
* Google Maps popup overlay conflicts with Bootstrap CSS and other reset CSS
* that resets max-width on certain dom tags. The issue relies on how the overlay
* is built via multiple divs and img tags
*/
#map_canvas img{
max-width: none;
}
@codearachnid
codearachnid / admin_is_new.php
Created Aug 24, 2012
WordPress admin editor screen is new vs edit
View admin_is_new.php
<?php
/**
* use in WordPress editor to determine if is in new|edit mode
*
* @return bool
*/
function admin_is_new(){
global $post;
return (get_post_status($post->ID) == 'auto-draft');
@codearachnid
codearachnid / tribe_disable_default_meta.php
Created Aug 27, 2012
Disable author, excerpt and custom fields meta boxes in the event editor
View tribe_disable_default_meta.php
<?php
// used for Tri.be The Events Calendar
// disable author, excerpt and custom fields meta boxes in the event editor
function tribe_disable_default_meta() {
remove_post_type_support( TribeEvents::POSTTYPE, 'author' );
remove_post_type_support( TribeEvents::POSTTYPE, 'custom-fields' );
remove_post_type_support( TribeEvents::POSTTYPE, 'excerpt' );
}
add_action('init', 'tribe_disable_default_meta');