Skip to content

Instantly share code, notes, and snippets.

View melvinstanly's full-sized avatar
🌪️
Fast and Furious

Melvin Stanly melvinstanly

🌪️
Fast and Furious
View GitHub Profile
@melvinstanly
melvinstanly / wp-upload-folder.php
Last active November 5, 2018 10:27
Wordpress commonly used functions
<?php
// Get wordpress upload folder directory
function get_upload_folder_path(){
$current_user = wp_get_current_user();
$upload_dir = wp_upload_dir();
$uploads_folder = $upload_dir['basedir']; // Path to wordpress uploads folder
return $uploads_folder;
}
?>
@melvinstanly
melvinstanly / css-select.html
Last active September 4, 2018 10:18
Css tricks
// Custom scrolling bar for select
// Solution for no scroll in MAC browsers
<html>
<head>
<style>
.frame::-webkit-scrollbar {
-webkit-appearance: none;
}
@melvinstanly
melvinstanly / custom-tinymce-script.js
Last active September 5, 2018 07:09
tinyMCE related codes
jQuery(document).ready(function($) {
var divBodyConfig = {
selector: '.tinymce-body',
menubar: false,
inline: true,
plugins: [
'link',
'textcolor',
'lists',
// 'powerpaste',
@melvinstanly
melvinstanly / woocommerce-email-title.php
Last active March 11, 2021 22:36
Easy tricks in woocommerce emails
<?php
// Change email titles (Email template name in Woocommerce Settings Admin)
// woocommerce -> settings -> emails
add_filter( 'woocommerce_email_title', 'change_woocommerce_email_title', 10, 2 );
function change_woocommerce_email_title( $email_title, $email ){
$domain = "woocommerce"; // The text domain
@melvinstanly
melvinstanly / woo-checkout-order-review.php
Created September 12, 2018 06:52
Add custom field or html to review order table in WooCommerce Checkout
<?php
/* To add custom field in order review table in checkout page, you will have to use some of the hooks listed below.
do_action( 'woocommerce_review_order_before_cart_contents' );
do_action( 'woocommerce_review_order_after_cart_contents' );
do_action( 'woocommerce_review_order_before_shipping' );
do_action( 'woocommerce_review_order_after_shipping' );
do_action( 'woocommerce_review_order_before_order_total' );
do_action( 'woocommerce_review_order_after_order_total' );
@melvinstanly
melvinstanly / Grunt.txt
Last active February 6, 2020 06:33
Installing Grunt in Project
NB : Node should be installed
Installing grunt CLI globally
* npm install -g grunt-cli
Go to project folder and enter
* npm install grunt --save-dev
Install the modules required
@melvinstanly
melvinstanly / get_text_filter.php
Created October 22, 2018 04:26
Functions using the get_text filter
function custom_wc_translations( $translated_text, $text, $domain ) {
if(is_checkout()){
switch ($translated_text) {
case 'Replaceble_text' :
$translated_text = __('String to Replace', 'Domain');
break;
}
}
return $translated_text;
@melvinstanly
melvinstanly / scroll.php
Created November 1, 2018 12:58
Common CSS issues
<?php
// Content jumping when scroll bar is introduced
<div class="outer-wrapper">
<div class="inner-wrapper">
<div>
// Contents that affects overflow here
</div>
</div>
</div>
@melvinstanly
melvinstanly / php file upload.php
Created November 5, 2018 10:30
Php File Upload
<html>
<form id="sample_form" name="sample-form">
<p>
<label>Name</label><br>
<input value="Melvin Stanly" type="text">
</p>
<p>
<label>File</label><br>
<input id="example-file" type="file">
</p>
@melvinstanly
melvinstanly / spectrum-color-picker
Created December 3, 2018 05:44
Color picker not Displayed / mispositioned inside a scrollable div
Color picker won't appear when clicked, if it is inside a scrollable div.
Also when colorpicker is opened and scrolled, the colorpicker also get scrolled.
The solution to fix this is to add `position:relative` to the parent div in which input field, span(colorpicker preview) and
div(iris-picker iris-border).