Skip to content

Instantly share code, notes, and snippets.

View tomfinitely's full-sized avatar

Tom Finley tomfinitely

View GitHub Profile
@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 / 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 / organizer-featured-image
Created July 8, 2015 13:56
The Events Calendar Pro - Default Organizer Featured Images
@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 / 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 / genesis-featured-videos-for-single-pages.php
Last active September 21, 2015 14:19
Genesis Featured Video Thumbnails for Single Pages
@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 / su-multiple-post-thumbs.php
Created October 30, 2015 16:03
SU Multiple Post Thumbnails
//* Featured Events Secondary Featured Image
if (class_exists('MultiPostThumbnails')) {
new MultiPostThumbnails(array(
'label' => 'Featured Image 2',
'id' => 'featured-image-2',
'post_type' => 'su_feat_events'
) );
}
@tomfinitely
tomfinitely / gist:908d182fc7f010f03962e53407614b40
Created June 10, 2016 20:42
WordPress Advanced Custom Field (ACF) - Repeater with Conditional Subfields
//* Program Faculty
$faculty = get_field('faculty_listing');
if( have_rows('faculty_listing') ) :
echo '<section class="row" id="faculty"><div class="wrap"><h4>Faculty</h4><div class="faculty">';
while( have_rows('faculty_listing') ): the_row();
@tomfinitely
tomfinitely / gist:e93b2c3eff30e0ee94d3ded11fec00d9
Created June 10, 2016 20:44
WordPress Advanced Custom Field (ACF) - Conditional Checkboxes with Labels as Output (with option of Values as URLs)
//* Program Locations
$program_locations = get_field( 'program_locations' );
if ( $program_locations ) {
echo '<section class="location-widget widget widget_text"><div class="wrap widget-wrap">';
echo '<h4 class="widget-title widgettitle">Program Locations</h4>';
$field = get_field_object('program_locations');