Skip to content

Instantly share code, notes, and snippets.

View vajrasar's full-sized avatar

Vajrasar Goswami vajrasar

View GitHub Profile
@vajrasar
vajrasar / size.php
Created November 8, 2015 08:04
To add a Size Guide button that opens an image in lightbox based on category (ring or bangle) and if variation size is set -- WooCommerce
<?php
//To add a Size Guide button that opens an image in lightbox based on category (ring or bangle) and if variation size is set -- WooCommerce
//Use lightbox of your choice
add_action( 'woocommerce_before_add_to_cart_button', 'vg_sizing_placement', 5 );
function vg_sizing_placement() {
global $product, $post;
<?php
/*
* Automatically adding the product to the cart when cart total amount reach to $500.
*/
function aapc_add_product_to_cart() {
global $woocommerce;
$cart_total = 500;
@vajrasar
vajrasar / custom-hud-vajra.css
Created January 31, 2020 13:00
This is a custom HUD css that was created as a replacement of the Dark Theme mod available for the HUD. The reason - Dark Theme Mod is not fully compatible with most of the scripts which are written to enhance HUD.
::-webkit-scrollbar-thumb {
background: none;
}
/* left panel back color */
.chat__chat-queue {
background-color: #002b36;
color: #eee8d5;
}
@vajrasar
vajrasar / functions.php
Created March 6, 2018 13:54
+ Remove Default Color Menu from Theme Customizer. + Add a Primary Site Color element in Site Identity menu of the Theme Customizer. + Apply Color based on selection on the Primary Site Color option from the customizer
<?php
//Add Primary Color option in Site Identity and Remove default Colors menu
function your_theme_new_primary_color_settings($wp_customize) {
$wp_customize->remove_section( 'colors');
$wp_customize->add_setting('your_color');
$wp_customize->add_control(
@vajrasar
vajrasar / snippet.css
Last active September 20, 2017 14:40
To have image over gradient along with all browser support
/* In this particular instance client wanted to have gradient all over the background and a PNG
* image sitting at the bottom of the container
* /
.selector {
background-image: url(/path-to-image.png), -webkit-gradient(linear, left top, left bottom, from(rgba(74,177,253,1)), to(rgba(74,177,253,0.3))); /* For Safari 5.1 to 6.0 */
background-image: url(/path-to-image.png), -o-gradient(linear, left top, left bottom, from(rgba(74,177,253,1)), to(rgba(74,177,253,0.3))); /* For Opera 11.1 to 12.0 */
background-image: url(/path-to-image.png), -moz-gradient(linear, left top, left bottom, from(rgba(74,177,253,1)), to(rgba(74,177,253,0.3))); /* For Firefox 3.6 to 15 */
background-image: url(/path-to-image.png), linear-gradient(linear, left top, left bottom, from(rgba(74,177,253,1)), to(rgba(74,177,253,0.3))); /* Standard syntax (must be last) */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="rgba(74,177,253,1)",endColorstr="rgba(74,177,253,0.3)",GradientType=0), progid:DXImageTransform.Microsoft.Alp
@vajrasar
vajrasar / enqueue-version.php
Created September 15, 2017 12:00
Add dynamically updating version on file
<?php
/* Whenever the theme style file will update on server, this file version
* will automatically update
* Ref - https://developer.wordpress.org/reference/functions/wp_enqueue_style/#comment-2056
*/
wp_enqueue_style('main-styles',
get_template_directory_uri() . '/css/style.css',
array(),
@vajrasar
vajrasar / add_jetpack_infinite.php
Last active July 13, 2017 19:57 — forked from anonymous/add_jetpack_infinite.php
Steps to add Infinite Scroll (Jetpack) to a Genesis Child Theme running on Genesis 2.0 + HTML 5. Code goes in functions.php
<?php
/*
To add Infinite Loop Module provided in Jetpack wordpress Plugin, in Genesis driven site.
*/
/*
Step 1. Install Jetpack Plugin
*/
<?php //don't include this php tag while pasting snippet in your functions.php file
//to catch & print first image occuring in post content (the_content) via famous 'catch-that-image'
/* we could have also used genesis_get_image() to catch the first image instead of 'catch_that_image' script;
but genesis_get_image() was actually catching "first uploaded image" instead of "first image occuring in the_content".
*/
add_action('genesis_entry_header','image_above_t',7); //to place image above title
@vajrasar
vajrasar / AdminStyleSheet.php
Created April 19, 2016 12:02
Admin Style Sheet
<?php
// To add admin style
function load_admin_style() {
wp_enqueue_style( 'admin_css', get_template_directory_uri() . '/css/admin-style.css', false, '1.0.0' );
}
@vajrasar
vajrasar / quick_code.php
Created March 14, 2016 11:47
A short snippet for use in stack exchange (wordpress).
<?php //remove this
function loop_p_arch_infinite_scroll_render() {
$paged = get_query_var( 'paged', 1 );
?>
<div id="page-<?=$paged?>">
<?php while( have_posts() ) {
the_post();
get_template_part( 'content', 'product' );
}