Skip to content

Instantly share code, notes, and snippets.

View halgatewood's full-sized avatar

Hal Gatewood halgatewood

View GitHub Profile
@halgatewood
halgatewood / awe-forecast-text.php
Created April 7, 2015 05:44
Awesome Weather Forecast with Descriptions
// REPLACE STARTING AT LINE 318 in wp-content/plugins/awesome-weather/awesome-weather.php
$rtn .= "
<div class=\"awesome-weather-forecast-day\">
<div class=\"awesome-weather-forecast-day-temp\">{$forecast->temp}<sup>{$units_display}</sup></div>
<div class=\"awesome-weather-forecast-day-abbr\">$day_of_week</div>
<div class=\"awesome-weather-forecast-day-desc\">{$forecast->weather[0]->description}</div>
</div>
";
@halgatewood
halgatewood / redactor-blockquote-plugin
Last active August 29, 2015 14:20
Redactor Blockquote Button Plugin - FontAwesome Version
if (!RedactorPlugins) var RedactorPlugins = {};
RedactorPlugins.advanced = function()
{
return {
init: function ()
{
var button = this.button.add('bq', 'Blockquote');
this.button.setAwesome('bq', 'fa-quote-left');
this.button.addCallback(button, this.advanced.bqButton);
},
@halgatewood
halgatewood / awe_saturdays.php
Last active August 29, 2015 14:20
Awesome Weather Widget Custom Template - Show Weather for a Specific Day Only
// CALLED WITH FOLLOWING SHORTCODE FOR OPENWEATHERMAP
// [awesome-weather owm_city_id="3106050" location="Saturday's Forecast" custom_template_name="saturdays" size="custom" custom_bg_color="#ffffff" background="https://bulk.photo/lrg/33.jpg" units="F" forecast_days="10"]
<?php
$day_to_display = "Sat";
$weather_data = $weather->data;
$day_weather = false;
if( date('D') == $day_to_display )
{
@halgatewood
halgatewood / testimonial-rotator-data.php
Created May 19, 2015 22:01
Adding CycleTwo Data Arguments to the Testimonial Rotator
// ALL DATA ELEMENTS ARE FOUND HERE: http://jquery.malsup.com/cycle2/api/
// ADD data-cycletwo- TO THE BEGINNING
// NO WRAP FOR ALL ROTATORS
function hg_testimonial_rotator_data_attributes( $default, $template_name, $id )
{
return " data-cycletwo-allow-wrap='false' ";
}
add_filter('testimonial_rotator_data_attributes', 'hg_testimonial_rotator_data_attributes', 10, 3 );
@halgatewood
halgatewood / add-appid.php
Created May 21, 2015 16:39
Awesome Weather Widget Free (v1.5) Add an APPID. Get APPID here: http://openweathermap.org/register
function hg_awesome_weather_appid()
{
return "YOUR APPID HERE";
}
add_filter('awesome_weather_appid', 'hg_awesome_weather_appid');
@halgatewood
halgatewood / hg_awesome_weather_units_display.php
Created May 21, 2015 18:21
Awesome Weather Widget 1.5+ Change the Units Displayed to a Degree Symbol (or whatever else you want). https://wordpress.org/plugins/awesome-weather/
function hg_awesome_weather_units_display()
{
return "&deg;";
}
add_filter('awesome_weather_units_display', 'hg_awesome_weather_units_display' );
@halgatewood
halgatewood / awesome_weather_bg_ext.php
Created May 21, 2015 20:53
Awesome Weather Widget 1.5+ Change the different images per weather file extention. https://wordpress.org/plugins/awesome-weather/
function hg_awesome_weather_bg_ext()
{
return "png";
}
add_filter('awesome_weather_bg_ext', 'hg_awesome_weather_bg_ext' );
@halgatewood
halgatewood / gist:152ed36ec3df140e9319
Created June 9, 2015 17:16
Change the Testimonial Rotator Headings Globally
// CHANGE TESTIMONIAL ROTATOR HEADINGS
function hg_testimonial_rotator_title_heading( )
{
return "h3";
}
add_filter('testimonial_rotator_title_heading', 'hg_testimonial_rotator_title_heading' );
@halgatewood
halgatewood / awe_cf_conversions.php
Last active August 29, 2015 14:22
Convert Celsius to Fahrenheit and vice versa.
// CONVERSIONS
function hg_c_to_f( $c )
{
return round( ( $c * 1.8 ) + 32);
}
function hg_f_to_c( $f )
{
return round(($f- 32) / 1.8);
}
@halgatewood
halgatewood / gist:c46191ab7474f1dd1b68
Last active August 29, 2015 14:25
Inline Video Support - ACF Vimeo
<iframe src="https://player.vimeo.com/video/<?php the_field('video'); ?>" width="500" height="213" frameborder="0" webkit-playsinline></iframe>