Skip to content

Instantly share code, notes, and snippets.

Avatar

Amit Ramani amitramani

View GitHub Profile
@amitramani
amitramani / autocomplete.php
Created Apr 24, 2020
WooCommerce Price to Algolia AutoComplete Results Drop Down
View autocomplete.php
<script type="text/html" id="tmpl-autocomplete-header">
<div class="autocomplete-header">
<div class="autocomplete-header-title">{{{ data.label }}}</div>
<div class="clear"></div>
</div>
</script>
<!-- Amit Ramani: April 19, 2020 Added Price to the bottom of title -->
<script type="text/html" id="tmpl-autocomplete-post-suggestion">
<a class="suggestion-link" href="{{ data.permalink }}" title="{{ data.post_title }}">
<# if ( data.images.thumbnail ) { #>
View CreateNegativeKWList-Shopping.js
// Copyright 2015, Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@amitramani
amitramani / functions.php
Created Sep 10, 2017
To move the Archive Intro Text from the top (default) position to the bottom of the page (after shop loop)
View functions.php
/* Remove the Archive Headline and Text from the default location */
remove_action( 'genesis_archive_title_descriptions', 'genesis_do_archive_headings_open', 5);
remove_action( 'genesis_archive_title_descriptions', 'genesis_do_archive_headings_close', 15);
remove_action( 'genesis_archive_title_descriptions', 'genesis_do_archive_headings_headline', 10);
remove_action( 'genesis_archive_title_descriptions', 'genesis_do_archive_headings_intro_text', 12);
/* Now, add it back at the bottom */
add_action( 'woocommerce_after_shop_loop', 'ar_add_custom_hook_archive_description', 8);
add_action( 'ar_add_wc_archive_descr_text' , 'ar_do_custom_archive_description_text', 7, 3);
function ar_add_custom_hook_archive_description() {
@amitramani
amitramani / functions.php
Created Aug 22, 2016
How to send WooCommerce Checkout Error Messages to Google Analytics as Events
View functions.php
function load_ga_error_script() {
// Load the JS file (jquery is a dependency)
wp_enqueue_script( 'ga-send-error-event', get_stylesheet_directory_uri() . '/js/ga-send-error-event.js', array('jquery' ) );
}
add_action( 'wp_enqueue_scripts', 'load_ga_error_script' );
@amitramani
amitramani / functions.php
Created Jun 4, 2016
[WooCommerce] How to add Custom Fields to Products
View functions.php
add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' );
function woo_add_custom_general_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
woocommerce_wp_checkbox(
array(
'id' => '_no_free_shipping_checkbox',
@amitramani
amitramani / functions.php
Last active Feb 9, 2018
How to get Crawler Based Search Engine for Swiftype on WordPress using Genesis
View functions.php
// October 11, 2015 Change search form text from https://wpbeaches.com/change-search-field-default-text-genesis-wordpress-theme/
function themeprefix_search_button_text( $text ) {
return ( 'Start Typing...');
}
add_filter( 'genesis_search_text', 'themeprefix_search_button_text' );
function b3m_search_form( $form, $search_text, $button_text, $label ) {
$onfocus = " onfocus=\"if (this.value == '$search_text') {this.value = '';}\"";
$onblur = " onblur=\"if (this.value == '') {this.value = '$search_text';}\"";
@amitramani
amitramani / functions.php
Created Apr 16, 2016
Enqueue the JS File, Add Progress Bar to Checkout Page
View functions.php
/* Enqueue the JS File for manipulating the Progress Bar */
function my_theme_scripts() {
wp_enqueue_script( 'wc-checkout-progress-bar', get_stylesheet_directory_uri() . '/js/wc-checkout-progress-bar.js', array( 'jquery' ), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'my_theme_scripts' );
/* Add the Progress Bar to the Checkout Page */
function ar_add_progress_bar(){
echo do_shortcode('[wppb progress=50 option="animated-candystripe purple" location=inside fullwidth=true]');
}
You can’t perform that action at this time.