Skip to content

Instantly share code, notes, and snippets.

View jkudish's full-sized avatar

Joey Kudish jkudish

View GitHub Profile
@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 / 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 / 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 / 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 / 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++;
}
<?php
/**
* Filters the year dropdown in The Events Calendar plugin's grid view
* shows the current year isntead of the last 2
*
* @author Joachim Kudish @link http://jkudish.com
* @version 1.0
* @param (string) $yearOptions the number of years options string
* @return (string) $yearOptions the filtered number of years options string
*/
@jkudish
jkudish / functions.php
Created February 8, 2012 03:30
Overwrite timezone in PHP
<?php date_default_timezone_set('America/New_York'); ?>
<?php
global $post;
$get_posts = tribe_get_events(array('posts_per_page'=>10, 'venue'=>176) );
foreach($get_posts as $post) { setup_postdata($post); ?>
<div class="post">
<h4 class="post-header"><a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a></h4>
<span class="event-date"><a href="<?php the_permalink(); ?>"><?php echo tribe_get_start_date($post->ID, true, 'M j, Y'); ?></a></span>
<div class="post-content"><?php the_content(); ?></div>
@jkudish
jkudish / logged-in-events.php
Created January 25, 2012 20:04
Prevent non logged in users from seeing The Events Calendar
<?php
/*
Plugin Name: Logged in only events calendar
Plugin URI: http://tri.be/support/forums/topic/calendar-view/#post-14059
Description: Prevents non-loggedin users from seing The Events Calendar. Requires The Events Calendar by Modern Tribe Inc
Version: 0.1
Author: Joachim Kudish
Author URI: http://jkudish.com/
License: GPLv2
@jkudish
jkudish / always-login.php
Created January 13, 2012 21:08
Always logged in with WordPress
<?php
/**
* keeps a user always logged in
* don't use this on a production site, ever!
*/
add_action('init', 'auto_login');
add_action('admin_init', 'auto_login');
function auto_login() {