Skip to content

Instantly share code, notes, and snippets.

View halgatewood's full-sized avatar

Hal Gatewood halgatewood

View GitHub Profile
// Open Checkout with further options
handler_<?php echo $button_id ?>.open({
name: '<?php echo $checkout_name; ?>',
description: '<?php echo $checkout_desc; ?>',
amount: hg_ajax_amount_<?php echo $button_id ?> * 100,
panelLabel: "<?php echo $checkout_label; ?>",
allowRememberMe: <?php echo $checkout_remember; ?>,
currency: '<?php echo $currency_code; ?>',
zipCode: <?php echo $checkout_zipcode; ?>,
email: '<?php echo $checkout_email; ?>',
@halgatewood
halgatewood / showcase_with_icons.php
Created March 16, 2017 16:21
How to add icons to the Awesome Weather Widget Pro showcase template.
<?php foreach( $weather_forecast as $forecast ) { ?>
<div class="awesome-weather-forecast-day">
<i class="<?php echo $forecast->icon; ?>"></i>
<div class="awesome-weather-forecast-day-abbr"><?php echo $forecast->day_of_week; ?></div>
<div class="awesome-weather-forecast-day-temp"><?php echo $forecast->temp; ?></div>
</div>
<?php } ?>
function implode_piped_string( $array )
{
if( !$array ) { return ""; }
if( !is_array($array) ) { return ""; }
return "|" . implode("|", array_filter(array_unique($array))) . "|";
}
function explode_piped_string( $str )
{
return array_filter(array_unique(explode("|", $str)));
@halgatewood
halgatewood / page-children.php
Created December 15, 2016 19:04
A template for Vendd that lists the sub pages in a list.
<?php
/**
* Template Name: List Children Template
*/
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
let uploadRequest = AWSS3TransferManagerUploadRequest()
uploadRequest?.body = videoURL
uploadRequest?.key = fileName
uploadRequest?.bucket = S3BucketName
AWSS3TransferManager.default().upload(uploadRequest).continue(
{
(task) -> AnyObject! in
// ERROR
function hg_add_estimated_monthly()
{
$estimated = edd_estimated_monthly_stats();
?>
<div class="postbox metrics-sidebar">
<div class="inside" style="padding-top: 11px;">
<strong><?php _e( 'Estimated monthly earnings: ', 'easy-digital-downloads' ); echo edd_currency_filter( edd_format_amount( $estimated['earnings'] ) ); ?></strong>
<hr>
<strong><?php _e( 'Estimated monthly sales: ', 'easy-digital-downloads' ); echo edd_format_amount( $estimated['sales'], false ); ?></strong>
</div>
function hg_add_estimated_monthly()
{
$estimated = edd_estimated_monthly_stats();
?>
<div class="postbox metrics-sidebar">
<div class="inside">
<strong><?php _e( 'Estimated monthly earnings: ', 'easy-digital-downloads' ); echo edd_currency_filter( edd_format_amount( $estimated['earnings'] ) ); ?></strong>
<hr>
<strong><?php _e( 'Estimated monthly sales: ', 'easy-digital-downloads' ); echo edd_format_amount( $estimated['sales'], false ); ?></strong>
</div>
<?php
session_start();
date_default_timezone_set('America/Chicago');
// FUNCTIONS
require_once("/funcs/memcached.php");
require_once("/funcs/voice.php");
@halgatewood
halgatewood / awe_custom_images.php
Created June 28, 2016 17:45
Get the weather and time of day to display custom images, videos, etc with the Awesome Weather Widget
<?php
// OPENWEATHERMAPS:
$weather_name = awesome_weather_preset_condition_names_openweathermaps( $weather->data['current']['condition_code']);
// YAHOO
$weather_name = awesome_weather_preset_condition_names_yahoo( $weather->data['current']['condition_code']);
$current_time = get_the_time('H');
$tm = ( $current_time < 6 AND $current_time > 9 ) ? "night" : "day";
@halgatewood
halgatewood / awe_video.php
Last active September 26, 2017 21:27
A simple custom template that has a background video. It is based off the Wide default template.
<?php $weather_name = awesome_weather_preset_condition_names_openweathermaps( $weather->data['current']['condition_code']); ?>
<style>
.awesome-weather-main-content {
position: relative;
z-index: 10;
}
.awesome-weather-video-background {
position: absolute;
top: 0; right: 0; bottom: 0; left: 0;