Skip to content

Instantly share code, notes, and snippets.

View halgatewood's full-sized avatar

Hal Gatewood halgatewood

View GitHub Profile
@halgatewood
halgatewood / testimonial-rotator-slug.php
Created July 20, 2015 15:14
How to change Testimonial Rotator Slug
function change_testimonial_rotator_testimonial_slug( $name )
{
return "praise";
}
add_filter( 'testimonial_rotator_testimonial_slug', 'change_testimonial_rotator_testimonial_slug' );
@halgatewood
halgatewood / testimonial-rotator-has-archive.php
Created July 21, 2015 03:30
Remove the archive of testimonials for the Testimonial Rotator: https://wordpress.org/plugins/testimonial-rotator/
function hg_testimonial_rotator_pt_args( $args )
{
$args['has_archive'] = false;
return $args;
}
add_filter( 'testimonial_rotator_pt_args', 'hg_testimonial_rotator_pt_args' );
@halgatewood
halgatewood / gist:3209276e33dc5139a6ff
Last active August 29, 2015 14:25
Yahoo Weather Icons - Patch : To update function awesome_weather_get_icon_from_id in /awesome-weather-pro/pro/yahoo/funcs.php
// WEATHER ICONS MAPPING
function awesome_weather_get_icon_from_id($c)
{
if($c == 0) { return 'wi-tornado'; }
if($c == 1) { return 'wi-hurricane'; }
if($c == 2) { return 'wi-hurricane'; }
if( in_array( $c, array(3,4,37,38,39,40,42,45,47))) { return 'wi-thunderstorm'; }
if( in_array( $c, array(5,6,7,10,18))) { return 'wi-rain-mix'; }
if($c == 8 OR $c == 9) { return 'wi-sprinkle'; }
if( in_array( $c, array(11,12))) { return 'wi-rain'; }
@halgatewood
halgatewood / testimonial-archive-order.php
Created September 1, 2015 18:22
Testimonial Rotator Archive Page Order By. Add this function to your functions.php file in your theme.
add_action( 'pre_get_posts', 'hg_change_testimonial_sort_order');
function hg_change_testimonial_sort_order($query)
{
if( is_main_query() AND is_post_type_archive('testimonial') )
{
$query->set( 'order', 'DESC' );
$query->set( 'orderby', 'date' );
}
}
@halgatewood
halgatewood / ServiceProvider.swift
Last active April 18, 2019 12:07
Completely Dynamic Apple TV Top Shelf using a Remote JSON file, Alamofire, Semaphore and SwiftyJSON
//
// ServiceProvider.swift
// BT Top Shelf
//
// Created by HalBook on 9/28/15.
// Copyright © 2015 HalGatewood.com. All rights reserved.
//
import Foundation
import TVServices
@halgatewood
halgatewood / include_in_search.php
Last active October 12, 2015 16:10
Reusable Text Block. Make searchable
function hg_text_blocks_post_type_args( $args )
{
$args['public'] = true;
$args['exclude_from_search'] = false;
return $args;
}
add_filter('text_blocks_post_type_args', 'hg_text_blocks_post_type_args');
public function add_share_buttons_to_post($content)
{
if (is_single() AND get_post_type() == "post") {
$location = get_option('ess_share_location');
$button_type = get_option( 'ess_share_type' );
if ( is_array( $location ) ) {
foreach($location as $position) {
if ($position == 'before') {
@halgatewood
halgatewood / awesome_weather_units_display.php
Last active November 24, 2015 20:54
Change the Units Display for Awesome Weather Widget
function hg_awesome_weather_units_display()
{
return "F";
}
add_filter('awesome_weather_units_display', 'hg_awesome_weather_units_display');
@halgatewood
halgatewood / no-google-font.php
Created December 16, 2015 17:08
Use this function to stop using the Google Font Open Sans with the Awesome Weather Widget.
function hg_awesome_weather_use_google_font()
{
return false;
}
add_filter('awesome_weather_use_google_font', 'hg_awesome_weather_use_google_font');
function hg_awesome_weather_ip_cache()
{
return 3600; // IN SECONDS
}
add_filter('awesome_weather_ip_cache', 'hg_awesome_weather_ip_cache');