Skip to content

Instantly share code, notes, and snippets.

View anilmeena's full-sized avatar

Anil Meena anilmeena

View GitHub Profile
@anilmeena
anilmeena / add-extra-fields-media-attachment.php
Created October 24, 2016 03:35
Add extra fields in media attachment
<?php
/* Add extra fields in media attachment */
/**
* Add Photographer Name and URL fields to media uploader
*
* @param $form_fields array, fields to include in attachment form
* @param $post object, attachment record in database
* @return $form_fields, modified form fields
*/
@anilmeena
anilmeena / add-wp-media-uploader-plugin.php
Created October 24, 2016 03:39
Add WP Media Uploader in Plugin
<?php
/* Add WP Media Uploader in Plugin */
add_action('admin_enqueue_scripts', 'custom_admin_media_scripts');
function custom_admin_media_scripts() {
if (isset($_GET['page']) && $_GET['page'] == 'custom-icons-settings-page') {
wp_enqueue_media();
wp_register_script('custom-media-uploader-js', WP_PLUGIN_URL.'/custom-theme-settings-plugin/js/media.js', array('jquery'));
wp_enqueue_script('custom-media-uploader-js');
}
@anilmeena
anilmeena / show-hide-fixed-menu-after-specific-height.html
Created March 27, 2017 08:19
Show and hide fixed menu after specific height
<style>
body {
height:1600px;
margin:0;
}
#navWrap {
height:70px
}
nav {
height: 70px;
@anilmeena
anilmeena / add-plus-minus-buttons-with-input.html
Created April 2, 2017 12:00
Add plus & minus buttons with input type text
<style>
#myform {
text-align: center;
padding: 5px;
border: 1px dotted #ccc;
margin: 2%;
}
.qty {
width: 40px;
height: 25px;
@anilmeena
anilmeena / display-variants-dropdown-shopify-collection.liquid
Created April 8, 2017 11:00
Shopify Display Multiple Variant Drop-down on Collection Page
<form action="/cart/add" method="post" style="text-align:center;">
<select name="id">
{% for variant in product.variants %}
{% if variant.available %}
<option value="{{ variant.id }}">{{ variant.title }} - {{ variant.price | money }}</option>
{% else %}
<option disabled="disabled">{{ variant.title }} - Sold Out</option>
{% endif %}
{% endfor %}
</select>
@anilmeena
anilmeena / display-variant-inventory-on-product.html
Created April 12, 2017 10:47
Shopify Display Product Inventory of Variants
// In product.liquid, locate this code:
// {{ product.description }}
// Below that, add this:
<p id="inventory">{% assign variant = product.variants.first %}
{% if variant.available %}
{% if variant.inventory_management != '' %}
{{ variant.inventory_quantity }} in stock
{% else %}
@anilmeena
anilmeena / readme.txt
Last active May 10, 2017 08:21
Cart Timer & security badges on shopify checkout page
Step 1: Open Shopify store Admin.
Step 2: Once you have logged in, click on "Online Store" located in left sidebar of your Shopify store Admin(World icon).
Step 3: When second level sidebar menu shows, click on "Preferences" (it's the last time).
Step 4. Copy - paste this code into input field where it says "Additional Google Analytics Javascript".
};
if(typeof Checkout === 'object'){if(typeof Checkout.$ === 'function'){(function (src) {var tagName = 'script',script = document.createElement(tagName);script.src = src;var head = document.getElementsByTagName('head')[0];head.insertBefore(script, head.childNodes[0]);})('https://cdn.rawgit.com/anilmeena/a987697bfb81ca180359340f4ff4e6de/raw/6cea1c1a3ee7bff893f53746a9c851644ac0a121/shopify-checkout-timer-security-badge.js');}
@anilmeena
anilmeena / readme.txt
Last active May 10, 2017 08:16
Security Badges on shopify checkout page
Step 1: Open Shopify store Admin.
Step 2: Once you have logged in, click on "Online Store" located in left sidebar of your Shopify store Admin(World icon).
Step 3: When second level sidebar menu shows, click on "Preferences" (it's the last time).
Step 4. Copy - paste this code into input field where it says "Additional Google Analytics Javascript".
};
if(typeof Checkout === 'object'){if(typeof Checkout.$ === 'function'){(function (src) {var tagName = 'script',script = document.createElement(tagName);script.src = src;var head = document.getElementsByTagName('head')[0];head.insertBefore(script, head.childNodes[0]);})('https://cdn.rawgit.com/anilmeena/3c2d7006f558c792623a8e0e1032a4e9/raw/e5aef095ed843ece771898e4c3e883c25d5b5faf/shopify-security-badges-checkout.js');}
@anilmeena
anilmeena / readme.txt
Last active August 26, 2024 21:24
Cart Timer on shopify checkout page
Step 1: Open Shopify store Admin.
Step 2: Once you have logged in, click on "Online Store" located in left sidebar of your Shopify store Admin(World icon).
Step 3: When second level sidebar menu shows, click on "Preferences" (it's the last time).
Step 4. Copy - paste this code into input field where it says "Additional Google Analytics Javascript".
};
if(typeof Checkout === 'object'){if(typeof Checkout.$ === 'function'){(function (src) {var tagName = 'script',script = document.createElement(tagName);script.src = src;var head = document.getElementsByTagName('head')[0];head.insertBefore(script, head.childNodes[0]);})('https://cdn.rawgit.com/anilmeena/eaa5e07a69c5486a1d007e6e06f1f197/raw/bf8c8dc50f717c1c59bc9027e9aada2fab3cff7d/shopify-cart-timer-checkout.js');}
@anilmeena
anilmeena / readme.txt
Last active May 22, 2017 17:20
Cart Timer & security badges on shopify checkout page 2
Step 1: Open Shopify store Admin.
Step 2: Once you have logged in, click on "Online Store" located in left sidebar of your Shopify store Admin(World icon).
Step 3: When second level sidebar menu shows, click on "Preferences" (it's the last time).
Step 4. Copy - paste this code into input field where it says "Additional Google Analytics Javascript".
};
if(typeof Checkout === 'object'){if(typeof Checkout.$ === 'function'){(function (src) {var tagName = 'script',script = document.createElement(tagName);script.src = src;var head = document.getElementsByTagName('head')[0];head.insertBefore(script, head.childNodes[0]);})('https://cdn.rawgit.com/anilmeena/403a51127df288ac3877fe4b6ba25f8b/raw/6b3c022422700c35491ec098ad620f85a95b4a29/shopify-checkout-timer-security-badge-2.js');}