Skip to content

Instantly share code, notes, and snippets.

View sabotawsh's full-sized avatar

Natasha McDiarmid sabotawsh

View GitHub Profile
@sabotawsh
sabotawsh / wp_alt_title_thumb.php
Created April 28, 2020 21:51 — forked from fjaguero/wp_alt_title_thumb.php
Wordpress: Get ALT and TITLE for the post thumbnail
<?php if ( has_post_thumbnail() ) :?>
<a href="<?php the_permalink() ?>" class="thumb"><?php the_post_thumbnail('thumbnail', array(
'alt' => trim(strip_tags( $post->post_title )),
'title' => trim(strip_tags( $post->post_title )),
)); ?></a>
<?php endif; ?>
@sabotawsh
sabotawsh / woocommerce_sitewidebanner
Created July 14, 2020 21:17
If site wide banner is toggled on, nudge fixed header down
// WOOCOMMERCE – IF SITE WIDE BANNER IS ACTIVE
// DROP MAIN NAV DOWN
if ( jQuery('.woocommerce-store-notice').css('display') == "block") {
$('header.navigation').addClass('drop-low');
}
// IF SITE WIDE BANNER IS DISMISSED
// BRING MAIN NAVIGATION BACK TO TOP
$('.woocommerce-store-notice__dismiss-link').on('click', function(){
$('header.navigation.drop-low').removeClass('drop-low');
})
@sabotawsh
sabotawsh / header.js
Created July 14, 2020 21:18
When a site wide banner is toggled on, push the fixed header down so they do not overlap.
// IF SITEWIDE BANNER IS ON
// PUSH SECONDARY ANCHOR NAV DOWN LOWER
(function($) { // Begin jQuery
$(function() { // DOM ready
if ($('.sitewide-banner')[0]) {
$('header').addClass('header--low');
};
}); // end DOM ready
})(jQuery); // end jQuery