Skip to content

Instantly share code, notes, and snippets.

Avatar

bantunes bantunesm

View GitHub Profile
@DWboutin
DWboutin / functions.php
Created Aug 18, 2014
Woocommerce get regular and sale price
View functions.php
<?php
function the_product_price($product){
//get the sale price of the product whether it be simple, grouped or variable
$sale_price = '<span class="new">'.get_post_meta( get_the_ID(), '_price', true).'</span>';
//get the regular price of the product, but of a simple product
$regular_price = get_post_meta( get_the_ID(), '_regular_price', true);
//oh, the product is variable to $sale_price is empty? Lets get a variation price
@smutek
smutek / content-page.blade.php
Last active Feb 16, 2022
Simple Sage 9 Slider with Slick
View content-page.blade.php
@php(the_content())
@if($images)
@include('partials/slider')
@endif
@webdados
webdados / shop_as_client_pro_customer_data.php
Last active Feb 24, 2022
How to add custom fields to the Shop as Client PRO add-on ajax call
View shop_as_client_pro_customer_data.php
<?php
/* Add this to you (child-)theme functions.php file, on a (mu-)plugin or with a plugin like Code Snippets https://wordpress.org/plugins/code-snippets/ */
add_filter( 'shop_as_client_pro_customer_data', 'my_shop_as_client_pro_customer_data', 10, 3 );
function my_shop_as_client_pro_customer_data( $data, $customer = null, $order = null ) {
//Are we getting a "customer" object?
if ( $customer ) {
//Custom checkout field with id "billing_xpto"
$data['billing']['xpto'] = $customer->get_meta( 'billing_xpto' );
@claudiosanches
claudiosanches / functions.php
Last active Jun 4, 2022
WooCommerce - Add Order Again button to My Orders actions
View functions.php
<?php
/**
* Add order again button in my orders actions.
*
* @param array $actions
* @param WC_Order $order
* @return array
*/
function cs_add_order_again_to_my_orders_actions( $actions, $order ) {
if ( $order->has_status( 'completed' ) ) {
@lopspower
lopspower / README.md
Last active Sep 30, 2022
Hexadecimal color code for transparency
View README.md

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@kepano
kepano / obsidian-web-clipper.js
Last active Oct 1, 2022
Obsidian Web Clipper Bookmarklet to save articles and pages from the web (for Safari, Chrome, Firefox, and mobile browsers)
View obsidian-web-clipper.js
javascript: Promise.all([import('https://unpkg.com/turndown@6.0.0?module'), import('https://unpkg.com/@tehshrike/readability@0.2.0'), ]).then(async ([{
default: Turndown
}, {
default: Readability
}]) => {
/* Optional vault name */
const vault = "";
/* Optional folder name such as "Clippings/" */