Skip to content

Instantly share code, notes, and snippets.

View BeardedGinger's full-sized avatar

Josh Mallard BeardedGinger

View GitHub Profile
@BeardedGinger
BeardedGinger / Meta box only on published post
Last active August 29, 2015 14:04
Only display meta box on a published posts edit screen.
public function add_meta_box() {
global $pagenow;
if( in_array( $pagenow, array( 'post.php' ) ) ) {
// Display only if post is published
add_meta_box(
);
}
}
@BeardedGinger
BeardedGinger / gist:b62b0d022412c3e2b010
Created March 10, 2015 17:04
Remove Organizer Link
<?php
/**
* Single Event Meta (Organizer) Template
*
* Override this template in your own theme by creating a file at:
* [your-theme]/tribe-events/modules/meta/details.php
*
* @package TribeEventsCalendar
*/
@BeardedGinger
BeardedGinger / gist:0863374dcf19f2ed427f
Created March 13, 2015 19:32
Social Sharing buttons
<?php
add_action( 'genesis_entry_header', 'gb_share_buttons', 6 );
//Add Social Sharing section to single posts
function gb_share_buttons() {
if( is_single() ) {
$url = get_permalink();
?>
@BeardedGinger
BeardedGinger / single-event.php
Created March 16, 2015 04:31
Add Featured Image to Events Calendar Month View
<?php
/**
* Month Single Event
* This file contains one event in the month view
*
* Override this template in your own theme by creating a file at [your-theme]/tribe-events/month/single-event.php
*
* @package TribeEventsCalendar
*
*/
.genesis-nav-menu .sub-menu .sub-menu {
margin: -48px 0 0 -199px
}
@BeardedGinger
BeardedGinger / gist:4d5174081842fe78cebb
Created April 14, 2015 13:25
Filter Community Events Event Category $args
<?php
add_filter( 'tribe_community_events_event_categories', 'ce_fe_cats_order', 100 );
/**
* Filter the $args for the event category option on the front-end form of Community Events
*/
function ce_fe_cats_order( $args ) {
$event_cat_ids = (array) $currently_selected;
if ( ! empty( $event->ID ) && empty( $currently_selected ) ) {
$event_cats = wp_get_object_terms( $event->ID, TribeEvents::TAXONOMY );
@BeardedGinger
BeardedGinger / gist:47b43c2be2ef86567465
Created April 22, 2015 18:51
Remove structured markup widget
<?php
add_filter( 'tribe_events_event_classes', 'remove_markup_events_widget' );
function remove_markup_events_widget() {
global $post, $wp_query;
$event_id = $post->ID;
if ( ! $event_id ) {
return '';
@BeardedGinger
BeardedGinger / lowest terms
Created April 28, 2015 14:17
get the lowest level term assigned to a post from a hierarchical taxonomy
<?php
//Find the lowest term on the totem pole
$parents = array();
$regions = get_the_terms( get_the_ID(), 'regions' );
foreach( $regions as $region ) {
$parents[] = $region->parent;
}
foreach( $regions as $region ) {
add_action( 'init', 'bg_shop_functions' );
function bg_shop_functions() {
remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
add_action( 'woocommerce_single_product_summary', 'add_shop_for_item_button', 20 );
add_action( 'woocommerce_single_product_summary', 'add_wishlist_form', 30 );
}
@BeardedGinger
BeardedGinger / Gravity Forms Input Container Class
Created July 20, 2015 04:32
Add gravity form field type to container ".ginput_container" div.
(function($) {
$.fn.gravityFieldTypes = function() {
var $this = $(this);
$this.each(function() {
var $input = $(this).find('>:first-child');
var $type = $input.prop('type');
$(this).addClass($type);