Skip to content

Instantly share code, notes, and snippets.

View tomfinitely's full-sized avatar

Tom Finley tomfinitely

View GitHub Profile
@tomfinitely
tomfinitely / faculty-acf-fields.php
Created July 16, 2014 15:11
Faculty & Video ACF Fields
if(function_exists("register_field_group"))
{
register_field_group(array (
'id' => 'acf_faculty-directory',
'title' => 'Faculty Directory',
'fields' => array (
array (
'key' => 'field_537a538dd069f',
'label' => 'Basic Info',
'name' => '',
@tomfinitely
tomfinitely / functions.php
Created July 17, 2014 18:58
Cross-Site Events Functions/Actions
// Events Calendar Modifications
if(class_exists( 'TribeEventsPro' )) {
include_once( CHILD_DIR . '/lib/events-widgets.php');
remove_action( 'widgets_init', 'events_calendar_load_featured_widget',100);
remove_action( 'widgets_init', 'events_list_load_widgets', 91 );
remove_action( 'widgets_init', 'events_calendar_load_widgets',100);
// Crazy-pants advanced widget magic
// $TribeEventsPro = new TribeEventsPro;
// remove_action( 'widgets_init', array($TribeEventsPro, 'pro_widgets_init'), 101 );
function do_it_activate_widgets() {
@tomfinitely
tomfinitely / events-widgets.php
Created July 17, 2014 19:06
Cross-Site Events Widgets
<?php
/**
* Master Calendar Upcoming Widget
*/
if( !class_exists( 'MasterCalendarUpcoming') ) {
class MasterCalendarUpcoming extends WP_Widget {
function MasterCalendarUpcoming() {
$widget_ops = array('classname' => 'MasterCalendarUpcoming', 'description' => __( 'Upcoming Events List from Master Calendar') );
@tomfinitely
tomfinitely / gist:1003f29506e6512bbb15
Created August 20, 2014 22:08
Genesis After Header Priority Mystery
//* Reposition Breadcrumbs
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
add_action( 'genesis_after_header', 'genesis_do_breadcrumbs', 6 );
//Page title relocation gateway, home & interior
add_action('genesis_after_header', 'relocate_page_titles', 8 );
function relocate_page_titles(){
if( is_front_page() ){
if( !is_main_site() ){
@tomfinitely
tomfinitely / gist:d865d05937d60e47ddb7
Last active August 29, 2015 14:13
Genesis Sandbox Featured Content (GSFC) Widget Subtitles Function
add_action ( 'gsfc_post_content','add_subtitle', 10);
function add_subtitle(){
if ( function_exists( 'the_subtitle' ) ) {
the_subtitle( '<p class="entry-subtitle">', '</p>' );
}
}
@tomfinitely
tomfinitely / events-widgets.php
Last active December 4, 2021 01:23
The Events Calendar Pro - Cross-site Events Widget
<?php
if ( ! defined( 'ABSPATH' ) ) die('-1');
/*
* WDG-customized version of the Events Calendar Pro mini calendar widget.
* Changes are noted inline.
* Replacing class name: Tribe__Events__Pro__Mini_CalendarWidget
*/
class MultisiteTribeEventsProMiniCalendarWidget extends WP_Widget {
function __construct() {
@tomfinitely
tomfinitely / gist:936c11d21e057e100236
Last active August 29, 2015 14:18
YouTube oEmbed Filter
// customize embed settings
function custom_youtube_settings($code){
if(strpos($code, 'youtu.be') !== false || strpos($code, 'youtube.com') !== false){
$return = preg_replace("@src=(['\"])?([^'\">\s]*)@", "src=$1$2&showinfo=0&rel=0&autohide=1", $code);
return $return;
}
return $code;
}
add_filter('embed_handler_html', 'custom_youtube_settings');
@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(
//* 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 / 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'); } ?>