Skip to content

Instantly share code, notes, and snippets.

View codearachnid's full-sized avatar
:octocat:
curiouser and curiouser

Timothy Wood codearachnid

:octocat:
curiouser and curiouser
View GitHub Profile
@codearachnid
codearachnid / tribe-view-helpers.class.php
Created April 12, 2012 22:54
Tri.be Event Calendar getMonthOptions bugfix
<?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 April 21, 2012 13:09
Extend the WP_Widget_Factory class by overloading the register method to allow for passing params
<?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 16:03
Wordpress: get all posts (or limit) from/by custom post type
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' );
<?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 August 3, 2012 19:46
Notify admin user of a manual override of the default UTC timezone setting in WordPress.
<?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 August 17, 2012 18:09
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.
<?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 August 17, 2012 23:24
Bugfix: Google Maps popup overlay conflicts with Bootstrap CSS and other CSS that resets max-width on certain dom tags
/**
* 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 August 24, 2012 03:34
WordPress admin editor screen is new vs edit
<?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 August 27, 2012 21:06
Disable author, excerpt and custom fields meta boxes in the event editor
<?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');