Skip to content

Instantly share code, notes, and snippets.

View lswilson's full-sized avatar

Lisa Sabin-Wilson lswilson

View GitHub Profile
if ( ! is_front_page() ) {
echo '<header id="header" class="col-full">';
woo_breadcrumbs();
if ( is_page( 'Get Help' ) ) {
$intro_text = drugfree_get_option( 'get_help' );
} elseif ( is_page ( 'Get Information' ) ) {
$intro_text = drugfree_get_option ( 'get_information' );
} elseif ( is_page ( 'Get Involved' ) ) {
$intro_text = drugfree_get_option ( 'get_involved' );
@lswilson
lswilson / style.css
Created April 27, 2014 21:29
testing gist
background: url(images/header-pale-blue.jpg) -webkit-gradient(linear, left bottom, right top, color-stop(0%, #a1a8b8), color-stop(24%, #ece4e1), color-stop(68%, #ece4e1), color-stop(100%, #7ba8c3));
/* Chrome,Safari4+ */
@lswilson
lswilson / category-to-taxonomy
Created April 2, 2014 17:02
WordPress: SQL Change multiple categories to a custom taxonomy
UPDATE
wp_term_taxonomy tax
inner join wp_term_relationships rel on tax.term_taxonomy_id=rel.term_taxonomy_id
inner join wp_posts p on rel.object_id=p.id
inner join wp_terms term on tax.term_id=term.term_id
set tax.taxonomy='taxonomy-name'
WHERE
p.post_type = 'post'
AND
tax.taxonomy='category'
@lswilson
lswilson / category-to-cpt.sql
Last active August 29, 2015 13:58
WordPress: SQL to migrate posts from a single category to its own custom post type
UPDATE wp_posts
inner join wp_term_relationships rel on wp_posts.id=rel.object_id
inner join wp_term_taxonomy tax on rel.term_taxonomy_id=tax.term_taxonomy_id
inner join wp_terms term on tax.term_id=term.term_id
set wp_posts.post_type='your_post_type'
WHERE
term.slug="category_name"
@lswilson
lswilson / gist:8240534
Created January 3, 2014 16:10
Added find a rental widget: widgets.php
<?php
add_action( 'widgets_init', 'realtor_register_widgets' );
function realtor_register_widgets() {
register_widget( 'realtor_social_widget' );
register_widget( 'realtor_ad_widget' );
register_widget( 'realtor_buzz_widget' );
register_widget( 'realtor_find_home_widget' );
register_widget( 'realtor_find_rental_widget' );
register_widget( 'realtor_ask_question_widget' );
register_widget( 'realtor_featured_posts_widget' );
@lswilson
lswilson / gist:8240518
Created January 3, 2014 16:09
find a rental: advice.min.js
;(function($){var locOpts={},$locAutocomplete=$("#location-autocomplete");if(typeof window.baseSvcUrl!=="undefined")locOpts.baseSvcUrl=window.baseSvcUrl;if(typeof window.baseValidationUrl!=="undefined")locOpts.baseValidationUrl=window.baseValidationUrl;if($locAutocomplete.length)$locAutocomplete.locationAutocomplete(locOpts);if(!Modernizr.input.placeholder)$("input[type=text]").each(function(){var $input=$(this),placeholder=$input.attr("placeholder");if(!placeholder)return true;$input.setVal=function(){if($input.is(":focus")){$input.removeClass("quiet");
if($input.val()===placeholder){$input.val("");$input.trigger("focus")}}else if($input.val()==="")$input.val(placeholder).addClass("quiet");else $input.removeClass("quiet")};$input.setVal();$input.on("focus blur change",function(){$input.setVal()})});$(document).ready(function(){var blogLocOpts={urlPrepend:"http://www.realtor.com/realestateandhomes-search/",urlAppend:""};if(typeof window.baseSvcUrl!=="undefined")blogLocOpts.baseSvcUrl=window.baseSvcUrl;if(type
@lswilson
lswilson / gist:8240505
Created January 3, 2014 16:08
Find a Rental: advice.js
;(function($){
var locOpts = {},
$locAutocomplete = $('#location-autocomplete');
if(typeof window.baseSvcUrl !== 'undefined')
locOpts.baseSvcUrl = window.baseSvcUrl;
if(typeof window.baseValidationUrl !== 'undefined')
@lswilson
lswilson / gist:8240471
Created January 3, 2014 16:06
Find A Rental: HTML
<form action="/" class="find-a-rental searchform unit-sub-body">
<div class="form-row form-row-inline">
<input type="text" class="s" name="find-a-rental-loc" id="find-a-rental-loc" placeholder="City, Zip or Neighborhood" />
<input type="submit" class="btn searchsubmit" value="Search" />
</div>
</form>
@lswilson
lswilson / content-author-tweet.php
Created September 13, 2013 03:13
Auto embed latest tweet from post author (based on Twitter ID field in author profile)
<?php
$curauth = get_userdata($post->post_author); //get data for current post author
$twitter_id = $curauth->twitter;
$api = array(
'consumer_key' => 'nbRYD9VZGOk8VDiqvuVg',
'consumer_secret' => 'MMtHXv9ErHjLEOcNJLjNWfC3WRVy1Qe3qHE4vl4Uo',
'oauth_access_token' => '1330201-jMrtoilTOGUCneecIV5yGYD6mUh8tmxbf5OWEUM',
'oauth_access_token_secret' => 'wzW875Vsj2xlGQivqvW1h35Zq7GkT6VqLVtBn0gJqY',
);
$tweets = ktp_get_tweets( $twitter_id, 1, $api );
@lswilson
lswilson / gist:6440431
Created September 4, 2013 17:56
Related Posts (via tags or categories)
/**
* Setup the in-post related posts list
*/
function wds_threatpost_related_posts() {
// Get tags, if they exist...
$tags = wp_get_post_tags( get_the_ID() );
if ( $tags ) {
$tag_ids = array();
foreach( $tags as $single_tag ) $tag_ids[] = $single_tag->term_id;