Skip to content

Instantly share code, notes, and snippets.

View jo-snips's full-sized avatar

Jonah West jo-snips

View GitHub Profile
@jo-snips
jo-snips / default_to_list.php
Created June 26, 2013 02:29
The Events Calendar - Default to List View on Event Categories
<?php
/*-------------------------------------------------------*/
/* Default to List View When Viewing Event Categories
/*-------------------------------------------------------*/
add_action( 'pre_get_posts', 'default_to_list_view' );
function default_to_list_view( $query ) {
if ( is_tax(TribeEvents::TAXONOMY) && $query->query_vars['post_type'] == TribeEvents::POSTTYPE && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'eventDisplay', 'upcoming' );
@jo-snips
jo-snips / filter-translation.php
Created June 18, 2013 16:23
The Events Calendar - Filter Translation
function filter_translations($translation, $text, $domain) {
if ($domain == 'tribe-events-calendar') {
switch ($text) {
case 'View All Events':
$translation = 'View The Calendar';
break;
}
}
return $translation;
@jo-snips
jo-snips / display_all_recurrences.php
Created June 12, 2013 22:07
The Events Calendar - Display All Recurrences of Event
<?php
global $post;
$all_events = tribe_get_events(array(
'eventDisplay'=>'all',
'name'=>get_the_title(),
'posts_per_page'=>-1
));
?>
<ul>
@jo-snips
jo-snips / add_published_date_col.php
Last active February 12, 2016 12:19
The Events Calendar - Add Published Date Column to Admin
/*-----------------------------------------------------------------------------------*/
/* Add Published Date Column to Tribe Events
/*-----------------------------------------------------------------------------------*/
add_filter( 'manage_edit-tribe_events_columns', 'my_edit_tribe_events' ) ;
function my_edit_tribe_events( $columns ) {
$columns['date'] = __('Date');
return $columns;
<?php
// use this method to replace the orininal in v1.0.5 (line 273 in the-events-calendar-facebook-importer.php)
function get_facebook_photo( $object_id ) {
$api_url = $this->build_url_with_access_token( $object_id . '/', array( 'fields' => 'cover', 'return_ssl_resources' => 1 ) );
$api_request = $this->json_retrieve( $api_url );
$new_path = $api_request->cover->source;
$get_photo = wp_remote_get( $api_request->cover->source );
// setup return object
$photo['url'] = $new_path;
<?php
/*
Template Name: Stock Report :)
*/
if (!is_user_logged_in() || !current_user_can('manage_options')) wp_die('This page is private.');
?>
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<?php
/**
* Loop Add to Cart
*/
global $product;
if( $product->get_price() === '' && $product->product_type != 'external' ) return;
?>
</php
/**
* Facebook Page Feed Parser
*
* @using cURL
*/
function fb_parse_feed( $page_id, $no = 5 ) {
// URL to the Facebook page's RSS feed.
<?php
// Add this to your functions.php file to create a venue query that queries venues in order of number of events.
// You may need to add a limit statement if you want more events to be returned than the default for the query.
add_filter( 'pre_get_posts', 'my_function_to_get_venues_by_event_numbers', 10, 1 );
function my_function_to_get_venues_by_event_numbers( $query ) {
$post_type = (array) $query->query_vars['post_type'];
if ( !is_single() && $post_type == array( TribeEvents::VENUE_POST_TYPE) ) {
add_filter( 'posts_fields', 'my_posts_fields_for_venues_function', 20, 1 );
add_filter( 'posts_join', 'my_posts_join_for_venues_function', 20, 1 );
add_filter( 'posts_where', 'my_posts_where_for_venues_function', 20, 1 );