Skip to content

Instantly share code, notes, and snippets.

View aibrean's full-sized avatar

April Sadowski aibrean

View GitHub Profile
@aibrean
aibrean / ACF Radio conditional.php
Last active August 29, 2015 14:22 — forked from fosturgh/Conditional ACF Menu
Conditional Options
<?php if(get_field('some-field', 'option') == 'on') { ?>
<?php } else { ?>
<?php } ?>
@aibrean
aibrean / theme-functions.php
Created May 7, 2015 15:59
Custom WooCommerce Lazy Load Product Thumbnail display.
function woocommerce_template_loop_product_thumbnail() {
$image_src = wp_get_attachment_image_src( get_post_thumbnail_id(),'full' );
echo '<img data-original="' . $image_src[0] . '" width="400" height="900" class="attachment-shop_catalog wp-post-image lazy"><noscript><img src="' . $image_src[0] . '" width="400" height="900" class="attachment-shop_catalog wp-post-image lazy"></noscript>';
}
@aibrean
aibrean / bootstrap-menu.js
Last active August 29, 2015 14:16
Bootstrap hover on dropdown and click on mobile.
$('.dropdown').on('mouseenter mouseleave click tap', function () {
$(this).toggleClass("open");
});
@aibrean
aibrean / map-scroll.js
Created February 11, 2015 20:55
Enable Google map zooming on click only (disable scrolling)
// Disable scroll zooming and bind back the click event
var onMapMouseleaveHandler = function (event) {
var that = $(this);
that.on('click', onMapClickHandler);
that.off('mouseleave', onMapMouseleaveHandler);
that.find('iframe').css("pointer-events", "none");
// pointer-events needs to be added as a style on the iframe
}
@aibrean
aibrean / blocklist
Last active August 29, 2015 14:09
Remove semalt and other bots from accessing your site - leads to false positive in Google Analytics
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_REFERER} ^http://.*backgroundpictures\.net/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*embedle\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*extener\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*fbfreegifts\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*feedouble\.com/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*feedouble\.net/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*joinandplay\.me/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://.*joingames\.org/ [NC,OR]
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="#">
<img alt="Brand" src="...">
</a>
</div>
</div>
</nav>
@aibrean
aibrean / css.css
Created September 9, 2014 20:25
Fork of Carousel Extended from Bootsnip to play nice with Bootstrap 3.2
.hide-bullets {
list-style:none;
margin-left: -40px;
margin-top:20px;
}
@aibrean
aibrean / acf-radio-button-example.php
Last active August 29, 2015 14:06 — forked from emaildano/acf-radio-button-example.php
ACF radio button outputs
<?php $program = get_sub_field('program_selection'); ?>
<?php if( $program == 'intensity' ){ ?>
<?php } else if( $program == 'crossfit' ){ ?>
<?php } else if( $program == 'personal' ){ ?>
<?php } else if( $program == 'allprograms' ){ ?>
@aibrean
aibrean / asset-depot-carousel.php
Last active August 29, 2015 14:06
Asset Depot Plugin - Front-end display code.
@aibrean
aibrean / image-array.php
Last active March 25, 2024 07:25
Demystifying the ACF image field. ACF (Advanced Custom Fields) allows users to use an ID, array, or URL for images. Once the field is set up in ACF, it’s up to you to get it to work correctly in your template/theme. This is known as the “return value” in ACF.
<?php
$image = get_field('image'); // assigns the image field to the variable of $image
if( !empty($image) ){ ?> <!-- if the $image variable isn't empty, display the following: -->
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" /> <!--displays the URL for the image variable and also the alt tag which is entered in the WordPress media library-->
<?php }; ?> <!--ends the if statement -->