- GitHub Staff
- http://astockwell.com
View taxonomy.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Reference | |
* | |
* Term object keys: | |
* [term_id, name, slug, term_group, term_taxonomy_id, taxonomy, description, parent] | |
* | |
*/ | |
View functions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Get everything you could ever want about a featured image | |
* | |
* Usage: | |
* <?php $image = get_featured_image(); ?> | |
* <img class="thumbnail" src="<?php echo $image['url']; ?>" alt="<?php echo $image['title']; ?>"> | |
* | |
* @param integer|object $post_id The ID/Object of the post that has the desired post thumbnail image | |
* @return false|array Null on failure to find the image, wp_prepare_attachment_for_js array on success |
View Vagrantfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
$script = <<SCRIPT | |
apt-get update | |
apt-get install -q -y wget make libtool automake autoconf bison flex unixodbc git mdbtools | |
cd /vagrant | |
echo "Get a copy of the MDB file and run 'vagrant ssh -c 'mdb-export /vagrant/database.mdb table_name > /vagrant/table_name.csv''" | |
SCRIPT | |
Vagrant.configure("2") do |config| |
View page.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Text Field --> | |
<?php $field_name_slug = get_field("field_name_slug"); if ( !empty($field_name_slug) ): ?> | |
<?php echo $field_name_slug; ?> | |
<?php endif; ?> | |
<!-- Image Field --> | |
<?php $image_field_name = get_field("image_field_name"); if ( $image_field_name ): ?> | |
<img src="<?php echo $image_field_name["url"]; ?>" alt="<?php echo $image_field_name["title"]; ?>" /> | |
<?php endif; ?> |
View sortStrings.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JsFiddle: http://jsfiddle.net/astockwell/6jxLeppm/4/ | |
// Array.prototype.filter polyfill for <= IE8 | |
if (!Array.prototype.filter) {Array.prototype.filter = function(fun/*, thisArg*/) {if (this === void 0 || this === null) {throw new TypeError(); } var t = Object(this); var len = t.length >>> 0; if (typeof fun !== 'function') {throw new TypeError(); } var res = []; var thisArg = arguments.length >= 2 ? arguments[1] : void 0; for (var i = 0; i < len; i++) {if (i in t) {var val = t[i]; if (fun.call(thisArg, val, i, t)) {res.push(val); } } } return res; }; } | |
var containsNoNumbers = function(s) { | |
return s.indexOf('0') === -1; | |
}; | |
var containsNumbers = function(s) { | |
return !containsNoNumbers(s); |
View gist:4157590
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import "compass/css3/images"; | |
// Partially via http://www.colorzilla.com/gradient-editor/ | |
@mixin nav-child-bg-color-alpha($color, $alpha: 0.5) { | |
background: url(screen.css); // Point to this css file. Fix for IE "No Transparency Click" bug on <a> elements w/ bg transparency. Via http://haslayout.net/css/No-Transparency-Click-Bug | |
@include background-image(linear-gradient(top, rgba($color, $alpha) 0%,rgba($color, $alpha) 100%)); | |
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#{ie-hex-str(rgba($color, $alpha))}', endColorstr='#{ie-hex-str(rgba($color, $alpha))}',GradientType=0 ); /* IE6-9 */ | |
} | |
// USEAGE: |
View gist:4177665
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if (WP_ENV != 'local' && WP_ENV != 'staging') { ?> | |
<script type="text/javascript"> | |
var _gaq = _gaq || []; | |
_gaq.push(['_setAccount', 'UA-xxxxxxxx-x']); | |
_gaq.push(['_trackPageview']); | |
(function() { | |
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; | |
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; | |
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); |
View script.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($('.lt-ie8').is('*')) { | |
//code | |
} |
View search.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php get_header(); ?> | |
<section> | |
<!-- Put the following javascript before the closing </head> tag. --> | |
<script> | |
(function() { | |
var cx = '000000000000000000000:aaa1aa1aa1a'; | |
var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true; | |
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') + | |
'//www.google.com/cse/cse.js?cx=' + cx; |
View loop.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Referencing http://wordpress.stackexchange.com/questions/1753/when-should-you-use-wp-query-vs-query-posts-vs-get-posts ?> | |
<?php | |
// EXAMPLE new WP_Query object | |
?> | |
<?php | |
// Query posts by new criteria. | |
$args = array( | |
'posts_per_page' => -1, |
OlderNewer