Skip to content

Instantly share code, notes, and snippets.

View jkudish's full-sized avatar

Joey Kudish jkudish

View GitHub Profile
@jkudish
jkudish / copy.php
Created February 12, 2012 00:56
Copy a string over and over in PHP
<?php
$i = 0;
$max_iterations = 300;
$string_to_copy = 'your string';
while ($i =< $max_iterations) {
echo $string_to_copy;
echo '<br><br>'; // just to have some space between each iteration
$i++;
}
@jkudish
jkudish / filter_ical.php
Created February 16, 2012 08:47
Filter the iCal link generated by The Events Calendar Pro to use the webcal protocol instead of http
<?php
/**
* Filter the iCal link generated by The Events Calendar Pro to use the webcal
* protocal instead of http
*
* Note: if you have https:// on your site, pelase adjust accordingly
*
* @author jkudish
* @param string $link the original
* @return string $link the filtered link
@jkudish
jkudish / page-random-event.php
Created February 18, 2012 01:01
This is an example of a query which gets a single random event from the 'featured' event category amongsts evetns from The Events Calendar
<?php
/**
* This is an example of a query which gets a single random event from the
* 'featured' event category amongsts evetns from The Events Calendar
*
* @see http://tri.be/support/forums/topic/random-featured-event-custom-widget/
*/
get_header();
@jkudish
jkudish / homepage.php
Created February 18, 2012 20:38
homepage.php
<?php /* Template Name: Home */ ?>
<?php get_header(); ?>
<?php // echo adrotate_group(1); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<div class="left">
<?php the_content() ?>
</div>
<div class="main-image"><?php the_post_thumbnail( 'full' ); ?></div>
@jkudish
jkudish / wp_dropdown_categories.php
Created February 22, 2012 06:09
wp_dropdown_categories for Tribe Events Taxonomy
<?php wp_dropdown_categories( array('taxonomy' => TribeEvents::TAXONOMY) ); ?>
@jkudish
jkudish / remove-scripts.php
Created February 24, 2012 03:21
remove tribe events scripts
<?php
add_action('wp_enqueue_scripts', 'tribe_remove_javascript');
function tribe_remove_javascript() {
wp_dequeue_script('sp-events-pjax');
wp_dequeue_script('sp-events-calendar-script');
}
@jkudish
jkudish / single-no-pagination.php
Created February 24, 2012 03:45
show all events on a single day view
<?php
add_filter('pre_get_posts', 'tribe_filter_days_on_single_day', 20);
function tribe_filter_days_on_single_day($query) {
if (tribe_is_day()) {
$query->set('nopaging', true);
}
return $query;
}
<?php
$role = get_role( 'administrator' );
$role->add_cap( 'edit_tribe_event' );
$role->add_cap( 'read_tribe_event' );
$role->add_cap( 'delete_tribe_event' );
$role->add_cap( 'edit_tribe_events' );
$role->add_cap( 'edit_others_tribe_events' );
$role->add_cap( 'publish_tribe_events' );
$role->add_cap( 'read_private_tribe_events' );
@jkudish
jkudish / no-index-single-tribe-events.php
Created March 3, 2012 06:26
noindex single tribe_events
<?php
add_action('wp_head','tribe_dont_index_single_events');
function tribe_dont_index_single_events() {
if ( is_singular() && get_post_type() == TribeEvents::POSTTYPE )
echo '<meta name="robots" content="noindex">';
}
@jkudish
jkudish / change-number-years.php
Created March 5, 2012 20:41
change the number of years in the dropdown for The Events Calendar
<?php
/**
* this is lines 563-573 of /lib/tribe-view-helpers.class.php
*/
private static function years( ) {
$year = ( int )date_i18n( 'Y' );
// Back two years, forward 5
$year_list = array( $year - 1, $year, $year + 1, $year + 2, $year + 3, $year + 4, $year + 5 );