Skip to content

Instantly share code, notes, and snippets.

View jkudish's full-sized avatar

Joey Kudish jkudish

View GitHub Profile
$ whois google.com
Whois Server Version 2.0
Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.
GOOGLE.COM.ZZZZZZZZZZZZZ.GET.ONE.MILLION.DOLLARS.AT.WWW.UNIMUNDI.COM
GOOGLE.COM.ZZZZZ.GET.LAID.AT.WWW.SWINGINGCOMMUNITY.COM
@jkudish
jkudish / archive-cpt.php
Created October 5, 2011 05:36
Modify a query to show an archive of CPTs
<?php
add_action('pre_get_posts', 'ipstenu_pre_get_posts');
function ipstenu_pre_get_posts($query){
if ($query->is_page('name-of-your-page')) { // any and all conditionals work here as a method of the $query object
$query->set('post_type', 'video'); // use the set method as if you were using a regular WP_Query or query_posts etc...
$query->set('posts_per_page', 10);
}
}
@jkudish
jkudish / gist:1338686
Created November 4, 2011 04:53
THIS FILE EXPLAINS HOW TO USE THE sld_register_post_type() function
<?php
// THIS FILE EXPLAINS HOW TO USE THE sld_register_post_type() FUNCTION FROM THE FOLLOWING WP PLUGIN: https://github.com/jkudish/sld-custom-content-and-taxonomies
/**
* sld_register_post_type()
* @param $post_type_slug the slug of the type to register
* @param $optional_args can be passed all of the same arguments as register_post_type()
* @see http://codex.wordpress.org/Function_Reference/register_post_type
* @param $optional_custom_plural, the plural name for this post type
@jkudish
jkudish / gist:1338692
Created November 4, 2011 05:02
THIS FILE EXPLAINS HOW TO USE THE sld_register_taxonomy() FUNCTION
<?php
// THIS FILE EXPLAINS HOW TO USE THE sld_register_taxonomy() FUNCTION FROM THE FOLLOWING WP PLUGIN: https://github.com/jkudish/sld-custom-content-and-taxonomies
/**
* sld_register_taxonomy()
* @param $taxonomy_slug the slug of the taxonomy to register
* @param $post_types, the post types that use this taxonomy
* @param $optional_singular_name, the singular name for this post type
* @param $optional_args can be passed all of the same arguments as register_taxonomy()
<h1>Upcoming events:</h1>
<?php global $post;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$upcoming = tribe_get_events( array('eventDisplay'=>'past', 'posts_per_page'=>1,'paged' => get_query_var('page')) );
foreach($upcoming as $post) : setup_postdata($post);?>
<div class="single-event">
<div class="title"><a href="<?php the_permalink() ?>" rel="bookmark">
<?php the_title(); ?>
</a> </div>
<?php endforeach; ?>
@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() {
@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
<?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 / functions.php
Created February 8, 2012 03:30
Overwrite timezone in PHP
<?php date_default_timezone_set('America/New_York'); ?>
<?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
*/