Skip to content

Instantly share code, notes, and snippets.

@jbd91
jbd91 / snippet.php
Last active June 14, 2018 15:53
ACF Image
<?php $img = get_field('field_name'); ?>
<!-- LARGE -->
<img src="<?php echo $img['sizes']['large']; ?>" width="<?php echo $img['sizes']['large-width']; ?>" height="<?php echo $img['sizes']['large-height']; ?>" alt="<?php echo $img['alt']; ?>" />
<!-- Medium -->
<img src="<?php echo $img['sizes']['medium']; ?>" width="<?php echo $img['sizes']['medium-width']; ?>" height="<?php echo $img['sizes']['medium-height']; ?>" alt="<?php echo $img['alt']; ?>" />
@jbd91
jbd91 / snippet.scss
Created February 12, 2018 06:00
Sticky Nav
&.sticky {
position: fixed;
top: 0;
z-index: 1000;
background: $white;
width: 100%;
transition: all 0.8s ease;
border-bottom: 3px solid $blue;
}
@jbd91
jbd91 / snippet.scss
Created February 12, 2018 06:00
Sticky Nav Admin Bar & Off Canvas Fixes
// ADMIN BAR FIXES
.admin-bar {
.nav-desktop {
&.sticky {
top: 32px !important;
@media screen and (max-width: 600px) {
@jbd91
jbd91 / snippet.js
Created February 12, 2018 17:51
Remove Element at Bottom of Page
$(window).scroll(function() {
$(".quick-question").removeClass("hide");
if($(window).scrollTop() + $(window).height() > ($(document).height() - 100) ) {
//you are at bottom
$(".quick-question").addClass("hide");
}
});
@jbd91
jbd91 / snippet.php
Created February 12, 2018 22:44
Pagination Class Structure Example
<?php // Borrowed with love from FoundationPress
function joints_page_navi() {
global $wp_query;
$big = 999999999; // This needs to be an unlikely integer
// For more options and info view the docs for paginate_links()
// http://codex.wordpress.org/Function_Reference/paginate_links
$paginate_links = paginate_links( array(
'base' => str_replace( $big, '%#%', html_entity_decode( get_pagenum_link( $big ) ) ),
'current' => max( 1, get_query_var( 'paged' ) ),
'total' => $wp_query->max_num_pages,
@jbd91
jbd91 / snippet.scss
Created February 13, 2018 17:56
External Link Styles
a[href*="//"]:not([href*="carewisconsin.com"]):not([href*="pantheonsite.io"]) {
/* external link styles, use :before or :after if you want! */
}
// '^=' means starts with
// '^*' means contains
// Covers relative paths, primary site, and development site
@jbd91
jbd91 / snippet.php
Created February 13, 2018 18:04
ACF Set Parent Category
<?php
// Check parent category, check if parent category has sub categories, display sub categories of parent that have posts associated.
$term = get_field('parent_category');
if ($term) {
$args = ['parent' => $term];
$categories = get_categories($args);
if (!empty($categories)) {
echo '<div class="child-categories widget widget_categories">';
@jbd91
jbd91 / snippet.php
Created February 16, 2018 06:00
Mixitup post categories as filter
<p class="project-categories">
<?php $categories = get_the_category();
$separator = ' | ';
$output = '';
$catgeories = get_terms([
'taxonomy' => 'category',
'hide_empty' => false,
'exclude' => [1],
]);
@jbd91
jbd91 / snippet.scss
Created February 19, 2018 17:00
Foundation (Older Versions) End Column Float Override
[class*="column"]+[class*="column"]:last-child {
float: left;
}
@jbd91
jbd91 / snippet.php
Created February 19, 2018 17:27
WP Custom Image Size
add_theme_support( 'post-thumbnails' );
// Custom image sizes
add_image_size( 'custom-size', 220, 180 ); // 220 pixels wide by 180 pixels tall, soft proportional crop mode
add_image_size( 'custom-size', 220, 180, true ); // 220 pixels wide by 180 pixels tall, hard crop mode
add_image_size( 'custom-size', 220, 220, array( 'left', 'top' ) ); // Hard crop left top