Skip to content

Instantly share code, notes, and snippets.

View outbravedigital's full-sized avatar

Duncan Michael-MacGregor outbravedigital

  • Outbrave Digital Limited - Web Design & Digital Marketing Agency
  • Vancouver, Canada
View GitHub Profile
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@rosswintle
rosswintle / gist:6899635
Created October 9, 2013 11:12
Code to do a WordPress query for posts that start with a given letter. Assumes a letter has been passed in the URL as "?s=a" where a is the letter. This code is part of some code that handles ajax requests. You'll need to write mytheme_ajax_list() to run a proper query and/or return results somehow.
// AJAX function for listing directory entries alphabetically
add_action('wp_ajax_directory_alpha', 'mytheme_ajax_directory_alpha');
add_action('wp_ajax_nopriv_directory_alpha', 'mytheme_ajax_directory_alpha');
function mytheme_ajax_directory_alpha() {
function alpha_post_where( $where ) {
$new_where = $where . " AND lower(substring(post_title, 1, 1)) = lower('" . $_REQUEST['s'] . "')";
return $new_where;
}
@pigmentGit
pigmentGit / Get alt-text on image with acf-repeater field
Created October 21, 2014 20:05
Get alt-text on image with acf-repeater field
<?php
if( have_rows('acf_repeaterfield') ):
while ( have_rows('acf_repeaterfield') ) : the_row();
$imageID = get_sub_field('acf_subfield');
$image = wp_get_attachment_image_src( $imageID, 'full' );
$alt_text = get_post_meta($imageID , '_wp_attachment_image_alt', true);
?>
<img src="<?php echo $image[0]; ?>" alt="<?php echo $alt_text; ?>" class="port-img front" />
@elliotcondon
elliotcondon / gist:c94abec50dc26ac065c6
Last active January 26, 2023 20:09
WooCommerce 'Create variations from all attributes' randomisation fix
<?php
/*
* array_cartesian
*
* This function will fix a frustrating issue in the WooCommerce plugin
* When adding a product using variations, you will most likely use the 'Create variations from all attributes' function
* The issue with this function is that it will create the variations in a random order
* This is frustrating for your clients to edit
*
@spivurno
spivurno / gw-gravity-forms-datepicker-kayak-style.css
Last active June 26, 2020 07:04
Gravity Wiz // Gravity Forms // Kayak-style Datepicker
/**
* Gravity Wiz // Gravity Forms // Kayak-style Datepicker
* Style your Gravity Forms Datepickers like Kayak.com
*/
.datepicker-clean.ui-datepicker {
background-color: #fff;
width: 516px !important;
box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.1) !important;
padding-left: 20px;
position: relative;