Skip to content

Instantly share code, notes, and snippets.

View c-askew's full-sized avatar

Cameron Askew c-askew

View GitHub Profile
add_action( 'wp_head', function () {
if (is_checkout()) {
?>
<script>
setTimeout(function() {
$('#place_order').html('Book Now');
}, 1500)
</script>
<?php }});
<script>
var $ = jQuery;
function headSearch() {
var location = $('#search-bar__location option:selected').text();
var bedrooms = $('#search-bar__activity option:selected').text();
var bathrooms = $('#search-bar__feature option:selected').text();
(location !== "Location...") ? $('.booking-search__form .location-input').val(location) : $('.booking-search__form .location-input').val('');
@c-askew
c-askew / functions
Created March 30, 2020 09:46
Use with Custom Product Tabs Pro - Set priority numbers to re-order tabs.
// Move custom product tab before description
add_filter( 'woocommerce_product_tabs', 'yikes_woo_reorder_tabs', 98, 1 );
function yikes_woo_reorder_tabs( $tabs ) {
if ( isset( $tabs['description'] ) ) {
$tabs['description']['priority'] = 2;
}
if ( isset( $tabs['features'] ) ) {
$tabs['features']['priority'] = 1;
}
@c-askew
c-askew / functions
Created February 21, 2020 09:42
Copies the Variation Description into the Main Description.
add_action( 'wp_footer', 'move_variation_description' );
function move_variation_description() {
global $product;
// Only on single product pages for variable products
if ( ! ( is_product() && $product->is_type('variable') ) ) return;
// jQuery code
?>
<script>
var $ = jQuery;
function transferDesc() {
@c-askew
c-askew / Read More Multiple Attempt
Last active March 3, 2020 11:55
Add a Read More/Read Less function to a specific div which appears based on it's height (> 400px by default).
<script>
var $ = jQuery;
$(window).on('load', function() {
function readMore(id) {
$('.read-more_' + id).addClass('read-more__open');
$('.read-more__button_' + id).off();
$('.read-more__button_' + id).text('Read Less');
$('.read-more__button_' + id).on('click', readLess );
}
function readLess(id) {
@c-askew
c-askew / functions
Created February 13, 2020 14:51
Create the [featuredimage] shortcode - to display a post/products featured image.
add_shortcode('featuredimage', 'thumbnail_in_content');
function thumbnail_in_content($atts) {
global $post;
return get_the_post_thumbnail($post->ID);
}
@c-askew
c-askew / css
Last active February 11, 2020 13:37
.home-products--products {
max-width: 60%;
flex-basis: 60%;
}
.home-products--products .box-excerpt {
display: none;
}
.home-products--products .category {
font-size: 0.65em;
@c-askew
c-askew / main
Created February 4, 2020 15:57
Add an on hover underline to menu items.
.menu__item > a span
{
position: relative;
}
.menu__item > a span:before {
content: "";
position: absolute;
width: 0;
height: 2px;
bottom: 0;
@c-askew
c-askew / css
Created January 24, 2020 14:06
4 Col Slider made with Slick.js Used on ABCGolf Shopify Site
/* Category Slider */
.category__carousel > .container {
padding: 0;
}
.category-slider-container {
background-color: #f1f1f1;
width: 1200px;
margin: auto;
}
.category-slider{
@c-askew
c-askew / account_button
Last active January 23, 2020 10:21
Used with conditional to show Account + Icon when user is logged out.
var $ = jQuery;
$(window).on('load', function() {
$('.header-nav .account-item span').replaceWith('<span class="account-item-text">Account</span><i class="icon-user"></i>')
});