Skip to content

Instantly share code, notes, and snippets.

View tomfinitely's full-sized avatar

Tom Finley tomfinitely

View GitHub Profile
@tomfinitely
tomfinitely / gsfw-targeted-instance.php
Last active October 13, 2015 16:40
Genesis Sandbox Featured Content Widget - Targeted Instance
//* Add "See All Videos" Link to Featured Videos
add_action( 'wp_head', 'target_gs_ftd' );
function target_gs_ftd() {
if ( is_active_widget( true, 'featured-content-3', 'featured-content', true ) ) {
add_filter( 'gsfc_after_loop', 'featured_content_3' );
function featured_content_3( $instance ) {
if ( 3 != $instance['custom_field'] ) {
return;
}
echo '<div class="more-wrapper"><a href="http://www.su.app/shenandoah-today/videos/">See All Videos</a></div>';
@tomfinitely
tomfinitely / genesis-featured-videos-for-single-pages.php
Last active September 21, 2015 14:19
Genesis Featured Video Thumbnails for Single Pages
@tomfinitely
tomfinitely / wp-cron-intervals.php
Created September 18, 2015 14:35
WP Cron Intervals
<?php
// Add a new interval of a week
// See http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules
add_filter( 'cron_schedules', 'myprefix_add_weekly_cron_schedule' );
function myprefix_add_weekly_cron_schedule( $schedules ) {
$schedules['weekly'] = array(
'interval' => 604800, // 1 week in seconds
'display' => __( 'Once Weekly' ),
);
@tomfinitely
tomfinitely / move-tec-nav
Created July 8, 2015 15:08
Move Events Calendar Navigation
add_action( 'wp_head', 'event_move_nav_genesis' );
function event_move_nav_genesis() {
if (tribe_is_event() || tribe_is_event_category() || tribe_is_in_main_loop() || tribe_is_view() || 'tribe_events' == get_post_type() || is_singular( 'tribe_events' )) {
//Reposition main nav
add_action( 'genesis_after_header', 'genesis_do_nav' , 10 );
//Reposition secondary nav
add_action( 'genesis_after_header', 'genesis_do_subnav' , 10 );
}
}
@tomfinitely
tomfinitely / organizer-featured-image
Created July 8, 2015 13:56
The Events Calendar Pro - Default Organizer Featured Images
@tomfinitely
tomfinitely / move-excerpt.php
Created June 16, 2015 21:19
WordPress - Move Excerpt Above Content Metabox
/* -----------------------------------------
* Put excerpt meta-box before editor
* ----------------------------------------- */
add_action( 'add_meta_boxes', 'my_add_excerpt_meta_box' );
function my_add_excerpt_meta_box( $post_type ) {
if ( in_array( $post_type, array( 'tribe_events' ) ) ) {
add_meta_box(
'contact_details_meta', __( 'Excerpt' ), 'post_excerpt_meta_box', $post_type, 'test', // change to something other then normal, advanced or side
'high'
@tomfinitely
tomfinitely / ecp-loop-fix
Created June 16, 2015 20:14
FIX FOR STATIC FRONT PAGE BEING OVERRIDDEN WHEN INCLUDING EVENTS IN MAIN BLOG LOOP
add_action( 'init', 'tribe_fix_homepage', 11, 1 );
function tribe_fix_homepage() {
remove_action( 'parse_request', array( 'TribeEventsQuery', 'parse_request' ), 50 );
add_action( 'parse_query', 'tribe_fix_homepage_query', 51 );
}
function tribe_fix_homepage_query( $query ) {
if ( ! $query->is_main_query() ) {
$query->is_home = false;
}
@tomfinitely
tomfinitely / ecp-thumb-conditional
Created June 16, 2015 19:28
ECP Thumbnail Conditional
<?php if ( !(tribe_event_featured_image())) { echo '<div><a href="' . tribe_get_event_link() . '"><img src="[image url goes here]" alt="' . the_title() . '" /></a></div>';} else { echo tribe_event_featured_image(null,'thumbnail'); } ?>
//* Genesis Featured Sandbox - Switch to Blog 1
add_action ( 'gsfc_before_post_content','add_event_info', 10);
function add_event_info(){
global $post;
if (tribe_get_start_date() !== tribe_get_end_date() ) {
echo tribe_get_start_date( null, false, 'l\, F jS' ) . ' from <meta itemprop="startDate" content="' . tribe_get_start_date( null, false, 'Y-m-d-h:i:s' ) . '"/>' . tribe_get_start_date(null, false, 'g:i a') . 'to <meta itemprop="endDate" content="' . tribe_get_end_date( null, false, 'Y-m-d-h:i:s' ) . '"/>' . tribe_get_end_date(null, false, 'g:i a');
@tomfinitely
tomfinitely / gist:02abfe9f9ac70158fd18
Last active August 29, 2015 14:21
Genesis Sandbox Featured Content Widget — Multisite Switch to Blog
//* Genesis Featured Sandbox - Switch to Blog 1
add_action ( 'gsfc_before_loop','add_category_links', 10);
function add_category_links(){
global $blog_id;
if( $blog_id == '1' ) {
echo '<div id="nav" class="filter-news"><div class="wrap"><div class="hover-drop"><a class="filter-click suicon-angle-circled-down" href="javascript:void(0)">Filter News</a>';
wp_nav_menu(