Skip to content

Instantly share code, notes, and snippets.

<?php
/**
* The Template for displaying all single posts.
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
get_header(); ?>
<div id="primary" class="site-content">
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div id="main">
*
* @package WordPress
* @subpackage Twenty_Twelve
* @since Twenty Twelve 1.0
*/
@prajwal-stha
prajwal-stha / custom.js
Created June 21, 2017 12:34
Part that deals with uploading image
document.getElementById('chooseFiles').addEventListener("change", function (e) {
var file = e.target.files[0];
var reader = new FileReader();
//alert(reader);
reader.onload = function (f) {
$("html, body").animate({
scrollTop: 0
}, 900);
@prajwal-stha
prajwal-stha / added.html
Created June 21, 2017 14:28
Added HTML
<div class="layout-options third-setting">
<h4>3. Select Border Type</h4>
<div id="gallery-wrapped" data-border-style="gallery-wrapped" class="layouts-select col-xs-12 col-sm-2 col-md-2 gallery-wrapped">
<img src="<?php echo get_stylesheet_directory_uri() .'/assets/img/mirror-img.jpg'; ?>" alt="<?php echo get_bloginfo( 'name') ; ?>">
<h4>Gallery Wrapped</h4>
</div>
<div id="mirror-wrapped" data-border-style="mirror-wrapped" class="layouts-select col-xs-12 col-sm-2 col-md-2 mirror-wrapped">
<img src="<?php echo get_stylesheet_directory_uri() .'/assets/img/wrap-img.jpg'; ?>" alt="<?php echo get_bloginfo( 'name') ; ?>">
<h4>Mirror Wrapped</h4>
</div>
@prajwal-stha
prajwal-stha / sample_reveal_module.js
Last active December 27, 2018 09:24
Sample Codes for The Module Pattern.
jQuery(document).ready(function($) {
'use strict';
var mblPPSeparateQty = {
addBtn: function() {
var topclass = '<div class="eci-add-to-cart-203204"><h5>Quantity:</h5>';
var inputgroup = '<div class="input-group"><span class="input-group-btn"><button type="button" class="btn btn-default btn-number" disabled="disabled" data-type="minus" data-field="quant[1]"><span class="eci-icon eci-icon-minus"></span></button></span><input type="text" name="quant[1]" class="form-control input-number" value="1" min="1" max="100000000"><span class="input-group-btn"><button type="button" class="btn btn-default btn-number" data-type="plus"data-field="quant[1]"><span class="eci-icon eci-icon-plus"></span></button></span></div>';
var btn = '<input class="eci-add-to-cart-btn" value="Add to Cart" id="ysw-add-to-cart" type="submit">';
var eci_jjp = {
eci_swap_sections: function( ){
$('#bodycontent .container').first().insertAfter($('#bodycontent .container').last());
return $(this);
},
eci_init: function(){
var obj = this;
obj.eci_swap_sections();
}
@prajwal-stha
prajwal-stha / global_code.js
Created July 24, 2017 09:56
Global Code placed from ABTasty.
/*ECI 10 Standard R-pts (additional 4 cart-closer r-pts) : sportsfanfare.com*/
console.log('Hello');
$(document).ready(function() {
var ecitests = [];
for(i = 0; i < ABTasty.tests.length; i++) {
ecitests.push(ecitests[i]);
ecitests[i] = ABTasty.tests[i].datas.id;
var ECIdebug = false;
var ABeventTrack = function(elem, val, testID) {
@prajwal-stha
prajwal-stha / functions.php
Last active August 1, 2017 15:59
Functions code
<?php
/**
* Crumina Theme Functions
*
*/
@prajwal-stha
prajwal-stha / function.php
Created August 1, 2017 15:54
Format phone number in US format
function format_phone_us($phone) {
// note: making sure we have something
if(!isset($phone{3})) { return ''; }
// note: strip out everything but numbers
$phone = preg_replace("/[^0-9]/", "", $phone);
$length = strlen($phone);
switch($length) {
case 7:
return preg_replace("/([0-9]{3})([0-9]{4})/", "$1-$2", $phone);
break;
@prajwal-stha
prajwal-stha / hex2rgb.js
Created October 8, 2017 11:08 — forked from polotek/hex2rgb.js
Convert hex colors to rgba
/**
* hex2rgb - function for converting hex colors to rgb(a)
*
* Shout out to http://hex2rgba.devoth.com/
*
* @hex (String) - The hex value. Can be prefixed with "#" or not. Can be
* long format (6 chars) or short format (3 chars)
* @opacity (number between 0 and 1) - This is an optional float value that
* will be used for the opacity
*