This file contains hidden or 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 | |
add_filter( 'body_class', function ( $classes ) { | |
$term = ( get_term_by( 'slug', get_query_var('term'), get_query_var('taxonomy') ) ); | |
if ( !$term ) | |
return $classes; | |
if ( 'subcategories' == get_metadata( 'woocommerce_term', $term->term_id, 'display_type', 1 ) ) { | |
$classes[] = 'display-subcategories'; | |
} | |
return $classes; | |
} ); |
This file contains hidden or 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 | |
$image = get_sub_field('background_image'); | |
// Image related details | |
$img_title = $image['title']; | |
$alt = $image['alt']; | |
$size = 'hero-video'; | |
$thumb = $image['sizes'][ $size ]; | |
$width = $image['sizes'][ $size . '-width' ]; |
This file contains hidden or 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 | |
add_action( 'woocommerce_review_before_comment_meta', 'comment_title' ); | |
function comment_title(){ | |
$field = get_field('title', 'comment_' . get_comment_ID()); | |
if($field){ | |
echo '<h4>' . $field .'</h4>'; | |
} | |
} |
This file contains hidden or 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
function get_thumbnail_url($size) { | |
$image_id = get_post_thumbnail_id(); | |
$image_url = wp_get_attachment_image_src($image_id, $size, true); | |
if (has_post_thumbnail()) { echo $image_url[0]; } | |
}; |
This file contains hidden or 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 | |
/* | |
* Loop for taxonomies to show their posts | |
*/ | |
$taxonomy = 'brand'; | |
$terms = get_terms($taxonomy); | |
foreach ($terms as $term) { | |
$wpq = array ( |
This file contains hidden or 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
<script type="text/javascript"> | |
jQuery(document).ready(function($){ | |
$.fn.scrollBottom = function() { | |
return $(document).height() - this.scrollTop() - this.height(); | |
}; | |
$(window).scroll(function () { | |
// Pick the element you want to move | |
var offset = $('#parent').offset(); | |
// This is the top of the view |
This file contains hidden or 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 | |
// Ensure cart contents update when products | |
// are added to the cart via AJAX | |
add_filter('add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment'); | |
function woocommerce_header_add_to_cart_fragment( $fragments ) { | |
global $woocommerce; | |
ob_start(); | |
echo '<a class="cart-contents" href="' . $woocommerce->cart->get_cart_url() .'" title="' . __( 'View your shopping cart', 'drivdigital' ) .'">'; | |
echo sprintf( _n( '%d item', '%d items', $woocommerce->cart->cart_contents_count, 'drivdigital' ), $woocommerce->cart->cart_contents_count) . ' - ' . $woocommerce->cart->get_cart_total(); | |
echo '</a>'; |
This file contains hidden or 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
p.stars { | |
position: relative; | |
font-size: u(1.5rem); | |
margin: 0; | |
text-align: center; | |
width: 200px; | |
margin: 0 auto; | |
a { |
This file contains hidden or 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
# Fire Escape // Add this alias incase theres a fire. | |
alias fire='git branch -b emergency-fire && git add -A && git commit -m "Theres a fire happening, so Im pushing everything I have so far incase the computers dont make it out alive!" && git push' |
This file contains hidden or 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
wget -r -P / --user-agent="" -e robots=off --wait 1 -E http://website.com |