Skip to content

Instantly share code, notes, and snippets.

View jo-snips's full-sized avatar

Jonah West jo-snips

View GitHub Profile
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@seedprod
seedprod / vt_resize.php
Created November 15, 2011 14:45
Resize WordPress images on the fly vt_resize w/ multisite support
<?php
/*
* Resize images dynamically using wp built in functions
* Victor Teixeira
*
* php 5.2+
*
* Exemplo de uso:
*
* <?php
@jo-snips
jo-snips / gist:2026901
Created March 13, 2012 05:00 — forked from luetkemj/wp-query-ref.php
WordPress: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php
*/
$args = array(
@jo-snips
jo-snips / mini-cal-day-link.php
Last active October 2, 2015 18:18
The Events Calendar: Mini Cal Day Link
@jo-snips
jo-snips / events-conditional-wrappers.php
Last active December 21, 2023 12:27
The Events Calendar: Basic Conditional Wrappers
<?php
/*-----------------------------------------------------------------------------------*/
/* Conditional Logic to Detect Various Event Related Views/Pages
/*-----------------------------------------------------------------------------------*/
if( tribe_is_month() && !is_tax() ) { // Month View Page
echo 'were on the month view page';
} elseif( tribe_is_month() && is_tax() ) { // Month View Category Page
@kovshenin
kovshenin / something.php
Created July 10, 2012 07:17
Yes, you can use printf and sprintf in WordPress too!
<?php
// Dirty, easy to miss a ' or " or .
echo '<a href="' . get_permalink() . '" class="link">' . get_the_title() . '</a>';
// Clean, easier to read
printf( '<a href="%s" class="link">%s</a>', get_permalink(), get_the_title() );
// Almost as clean, and more secure, maybe a little paranoic :)
printf( '<a href="%s" class="link">%s</a>', esc_url( get_permalink() ), esc_html( get_the_title() ) );
@sapegin
sapegin / footer.php
Created August 7, 2012 19:10
RequireJS in Wordpress theme
@jo-snips
jo-snips / custom-wp-seo-titles.php
Last active October 10, 2015 15:18
The Events Calendar: Custom Titles w/WP SEO
<?php
add_filter('wpseo_title','my_custom_titles');
function my_custom_titles($title) {
if( tribe_is_month() && !is_tax() ) { // The Main Calendar Page
return 'Events Calendar';
} elseif( tribe_is_month() && is_tax() ) { // Calendar Category Pages
return 'Events Calendar' . ' &raquo; ' . single_term_title('', false);
} elseif( tribe_is_event() && !tribe_is_day() && !is_single() ) { // The Main Events List
return 'Events List';
@jo-snips
jo-snips / custom-tribe-title.php
Last active September 5, 2018 07:30
The Events Calendar: Filter Tribe Events Title
add_filter('tribe_get_events_title','custom_get_events_title');
function custom_get_events_title( $depth=true ) {
global $wp_query;
$tribe_ecp = TribeEvents::instance();
$title = __('Class Schedule', 'tribe-events-calendar');
// TODO: Use the displayed dates for the title
/*
if ( tribe_is_upcoming() || isset( $_REQUEST['tribe-bar-date'] ) ) {
@jo-snips
jo-snips / custom-events-query.php
Created January 3, 2013 21:14
The Events Calendar - Get Events by Organizer
<?php
$args = array(
'post_type' => array(TribeEvents::POSTTYPE), // use post_type IN () to avoid old tribe queries
'posts_per_page' => -1,
'order' => 'ASC',
'meta_query' => array(
array(
'key' => '_EventOrganizerID',
'value' => get_the_ID(),