Skip to content

Instantly share code, notes, and snippets.

View jackabox's full-sized avatar
🛠️
Available for Hire

Jack Whiting jackabox

🛠️
Available for Hire
View GitHub Profile
@jackabox
jackabox / autolink.js
Last active December 31, 2015 13:19
Autolinking strings in JS
@jackabox
jackabox / hideLinks.js
Last active August 29, 2015 14:05
Hiding Li's over a max length
@jackabox
jackabox / autolink.php
Created August 12, 2014 15:21
Autolink in PHP
@jackabox
jackabox / relatedTags.php
Created August 12, 2014 15:50
WordPress: related posts by tags
<?php
$tags = wp_get_post_tags($post->ID);
if ($tags) { ?>
<div class="related-posts">
<?php
$first_tag = $tags[0]->term_id;
$tagsIDs = array();
@jackabox
jackabox / grid.scss
Last active August 29, 2015 14:07
Generating a grid in sass.
// Your columns are at a weird width here - Use the gutter on the row as well.
$width: 1244px;
$columns: 12;
$gutter: 16px;
.row {
width: 100%;
max-width: $width;
box-sizing: border-box;
@jackabox
jackabox / loop.php
Created January 5, 2015 15:26
Custom posts, by custom taxonomy.
<?php
$categories = get_terms( 'service-category' );
foreach ( $categories as $category ) {
$services = new WP_Query(
array(
'post_type' => 'services',
'showposts' => -1,
'tax_query' => array(
array(
'taxonomy' => 'service-category',
@jackabox
jackabox / navigation.php
Last active July 2, 2021 16:51
Building a Navigation from an Array
<?php
// The big ass array with all the data.
$navigation = [
[
'link' => 'index.php',
'title' => 'Top Level Navigation',
'children' => [
[
'link' => 'subitem.php',
@jackabox
jackabox / gallery.md
Last active August 29, 2015 14:21
Overflowing horizontally div, which scrolls on hot spot hover.
@jackabox
jackabox / filter.md
Created May 14, 2015 11:14
Filtering custom post types by an ACF field.

Filtering posts via an ACF field.

  • Define the acf key
  • grab the choices
  • create a select with choices
  • request on the meta key/meta value
@jackabox
jackabox / betterScrollingDivs.md
Last active August 29, 2015 14:21
Allowing content to scroll smoothly with the parent container.