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 | |
/** | |
* Returns today's event (or false if it one doesn't exist). If there is more than one it simply returns the first one. | |
* By 'today' I mean running today (though could have started earlier). You can change altering it slightly. | |
* | |
* @see http://wp-event-organiser.com/documentation/function/eo_get_events/ | |
* | |
*/ | |
function sh_get_todays_event(){ |
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 | |
/** | |
* Possible Bug With remove_action()/remove_filter() | |
* | |
* Only been tested with the pre_get_posts hook | |
* | |
* A hook is trigged. If a function removes itself from that that hook, all functions | |
* added with priority 10 are not triggered on that specific instance. | |
* |
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 | |
/** | |
* A function which adds classes to event pages corresponding to the event | |
* E.g. adds 'eo-event-cat-[cat slug]' class for each category the event belongs to. | |
* Adds 'eo-event-venue-[venue slug]' if the event has a venue | |
* Adds time based class: eo-event-future/past/running for future/past/running events | |
* | |
* @url http://wordpress.org/support/topic/problem-with-highlight-in-menu-change-url-of-events?replies=8#post-3458829 | |
* Not tested | |
*/ |
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 | |
/** | |
* Will print to the page the main query used for that page. It will do this only for admins. | |
* This can be put in your theme's functions.php, but should be removed when its no longer needed. | |
*/ | |
add_action( 'posts_request', 'debug_post_request', 10, 2 ); | |
function debug_post_request( $r, $query ){ | |
if( current_user_can( 'manage_options' ) && $query->is_main_query() ){ |
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 | |
function who_killed_me( $handler ){ | |
print_r( wp_debug_backtrace_summary() ); | |
return $handler; | |
} | |
add_filter( 'wp_die_handler', 'who_killed_me' ); | |
?> |
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 | |
/** | |
* Returns an array of available currencies. | |
* | |
* Applies the filter 'eventorganiser_currencies'. Returns an array of the form | |
* | |
* currency identifier => array( | |
* 'name' => currency name, | |
* 'symbol' => currency symbol, | |
* 'symbol_html' => symbol in html |
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 | |
/** | |
* Lightens/darkens a given colour (hex format), returning the altered colour in hex format.7 | |
* @param str $hex Colour as hexadecimal (with or without hash); | |
* @percent float $percent Decimal ( 0.2 = lighten by 20%(), -0.4 = darken by 40%() ) | |
* @return str Lightened/Darkend colour as hexadecimal (with hash); | |
*/ | |
function color_luminance( $hex, $percent ) { | |
// validate hex string |
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 | |
/** | |
* Simple shortcode to list events excluded by category | |
* @see http://wp-event-organiser.com/forums/topic/shortcodes-in-widget-i-need-to-exclude-category/ | |
* | |
* ## Usage | |
* [events_excluded_cats exclude_cats="1,12,18"] | |
*/ | |
function innonet_events_excluded_cats_handler( $atts, $content = null ){ | |
$taxs = array('category','tag','venue'); |
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 | |
/** | |
* Excludes specified event categories from any event query. Untested. | |
*/ | |
add_action( 'pre_get_posts','harris_exclude_event_terms' ); | |
function harris_exclude_event_terms( $query ) { | |
if ( $query->is_main_query() && eventorganiser_is_event_query( $query ) ) { |
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 | |
/** | |
* Prints colours of event categories to header on front-end | |
* @See http://wp-event-organiser.com/blog/tutorial/using-event-colours-in-your-theme/ | |
* @See http://wp-event-organiser.com/blog/tutorial/adding-event-colour-to-your-menu/ | |
* | |
*/ | |
add_action( 'wp_print_styles', 'my_print_event_cat_colours' ); | |
function my_print_event_cat_colours(){ |