Skip to content

Instantly share code, notes, and snippets.

View halgatewood's full-sized avatar

Hal Gatewood halgatewood

View GitHub Profile
@halgatewood
halgatewood / page-https.php
Created February 13, 2014 21:52
HTTPS Page in Wordpress
<?php
/**
* Template Name: HTTPS Page
*/
if($_SERVER['HTTPS']!="on")
{
wp_redirect( "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
exit;
}
stdClass Object
(
[name] => Default
[url] => https://halgatewood.com/wp-admin/css/colors.min.css
[colors] => Array
(
[0] => #222, [1] => #333, [2] => #0074a2, [3] => #2ea2cc
)
[icon_colors] => Array
(
function testimonial_rotator_change_order( $args )
{
$args['order'] = "DESC";
$args['orderby'] = "date";
return $args;
}
// USE THIS add_filter FOR THE WIDGET
add_filter('testimonial_rotator_widget_testimonial_args', 'testimonial_rotator_change_order');
global $_wp_admin_css_colors;
$color_scheme = get_user_option( 'admin_color' );
$current_admin_color_theme = $_wp_admin_css_colors[ $color_scheme ];
echo '
<style>
img.icon { color: ' . $current_admin_color_theme->colors[2] . '; }
img.icon.selected { color: ' . $current_admin_color_theme->colors[3] . '; }
</style>';
function hg_change_archive_order( $query )
{
if($query->is_archive AND $query->query['post_type'] == "testimonial")
{
$query->set( 'order' , 'asc' );
$query->set( 'orderby' , 'title' );
}
}
add_filter( 'pre_get_posts' , 'hg_change_archive_order' );
@halgatewood
halgatewood / ssl_post_thumbnail_html.php
Created March 7, 2014 08:04
Update post thumbnails in WordPress with https when needed.
function ssl_post_thumbnail_html( $html )
{
if( is_ssl() )
{
return str_replace("http://", "https://", $html);
}
else
{
return $html;
}
@halgatewood
halgatewood / hg-slider-excerpt-link.php
Created April 22, 2014 09:11
Update Excerpt More for HG Slider
@halgatewood
halgatewood / edd-stripe-checkout-currencies.php
Last active August 29, 2015 14:01
Add this function to your functions.php file in your theme.All support currencies for the Stripe Checkout Gateway for Easy Digital Downloads. http://halgatewood.com/downloads/stripe-checkout-gateway/ Please note that some currencies are not supported by American Express: https://support.stripe.com/questions/which-currencies-does-stripe-support
function hg_stripe_checkout_all_currencies( $currencies )
{
$currencies['INR'] = __('Indian Rupee', 'hg_edd');
$currencies['AED'] = __('United Arab Emirates Dirham', 'hg_edd');
$currencies['AFN'] = __('Afghan Afghani', 'hg_edd');
$currencies['ALL'] = __('Albanian Lek', 'hg_edd');
$currencies['AMD'] = __('Armenian Dram', 'hg_edd');
$currencies['ANG'] = __('Netherlands Antillean Gulden', 'hg_edd');
$currencies['AOA'] = __('Angolan Kwanza', 'hg_edd');
$currencies['ARS'] = __('Argentine Peso', 'hg_edd');
@halgatewood
halgatewood / prev-next-button-filters.php
Created May 15, 2014 06:10
Changing the Prev/Next Font Awesome Icons for my Testimonial Rotator
// HORIZONTAL SCROLLING AND FADING
function hg_change_next_icon()
{
return 'fa-arrow-circle-o-right';
}
add_filter('testimonial_rotator_fa_icon_next', 'hg_change_next_icon');
function hg_change_prev_icon()
{
@halgatewood
halgatewood / redirect_if_not_found.php
Created June 2, 2014 06:37
If the first parameter is not found then redirect to the second, If it is then do nothing.
function redirect_if_not_found( $item, $to )
{
if(!$item)
{
// WHATEVER OTHER HEADER OPTIONS YOU WANT CAN GO HERE, LIKE A 301
header("HTTP/1.1 301 Moved Permanently");
// REDIRECT
header("Location: $to");
}