Skip to content

Instantly share code, notes, and snippets.

View rickalee's full-sized avatar

Ricky Lee Whittemore rickalee

View GitHub Profile
@rickalee
rickalee / gist:7588915
Created November 21, 2013 20:22
Random Testimonial using Advanced Custom Fields Options Page
<?php
$rows = get_field( 'testimonials', 'option' );
$row_count = count($rows);
$i = rand(0, $row_count - 1);
echo '<blockquote><p>' . $rows[$i]['quote'] . '</p>';
echo '<cite>' . $rows[$i]['cite'] . '</cite></blockquote>';
?>
@rickalee
rickalee / gist:8028035
Last active December 31, 2015 18:39
Search Equipment
function search_filter($query) {
if ( !is_admin() && $query->is_main_query() ) {
if ($query->is_search) {
$query->set( 'post_type', array( 'listing' ) );
$query->set( 'posts_per_page', -1 );
}
}
}
add_action('pre_get_posts','search_filter');
@rickalee
rickalee / gist:8057807
Created December 20, 2013 16:54
iHomefinder Office Description Fix - Add to Source of WYSIWIG
<style type="text/css">/*
fixes alignment on mobile site
*/
#remarks {
float: inherit !important;
padding-bottom: 0px !important;
}
</style>
@rickalee
rickalee / gist:8290577
Last active January 2, 2016 10:29
Migrate former Base Theme to Functions.php enqueues
function swg_scripts() {
// Load our main stylesheet.
wp_enqueue_style( 'swg-style', get_stylesheet_uri() );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
wp_enqueue_script( 'swg-superfish', get_template_directory_uri() . '/js/superfish.js', array( 'jquery' ), '20131209', true );
@rickalee
rickalee / gist:8587678
Created January 23, 2014 22:01
VCF Support with WordPress/Cloud Sites
## Add to .htaccess
AddType application/octet-stream vcf
## Add to functions.php in active theme
add_filter('upload_mimes', 'custom_upload_mimes');
function custom_upload_mimes ( $existing_mimes=array() ) {
// add your extension to the array
$existing_mimes['vcf'] = 'text/x-vcard';
@rickalee
rickalee / gist:8608314
Created January 24, 2014 22:42
get_template_part for IDX Listing
<div class="listing">
<?php get_template_part( 'idx/single', 'gallery' ); ?>
<?php get_template_part( 'idx/single', 'title' ); ?>
<?php get_template_part( 'idx/single', 'price' ); ?>
<?php get_template_part( 'idx/single', 'description' ); ?>
@rickalee
rickalee / add_user_twitter.php
Last active March 26, 2018 14:31
Add Twitter handle/username to User Contact Information
<?php
/**
* Add Twitter handle/username to User Contact Information
*
* @param $user_contact
*
* @return array
*/
function user_contact_add_twitter( $user_contact ) {
$user_contact['twitter'] = __( 'Twitter Username' );
@rickalee
rickalee / clicktale.html
Created May 14, 2018 20:37
MSCC Clicktale
<script>
function clicktaleTracking() {
var s = document.createElement( 'script' );
var src = "https://cdnssl.clicktale.net/www07/ptc/959721af-e707-44b6-9b6a-d14f3ec0f756.js";
s.setAttribute( 'src', src );
document.body.appendChild( s );
}
</script>
<script>
$alt_text = get_post_meta( $slide['slide_background_file_id'], '_wp_attachment_image_alt', true );
@rickalee
rickalee / youtube_embed_no_cookie.php
Created March 27, 2018 02:55
Youtube No Cookie Domain