Skip to content

Instantly share code, notes, and snippets.

View utopianfool's full-sized avatar

Philip Porter utopianfool

View GitHub Profile
@nayemDevs
nayemDevs / functions.php
Last active July 28, 2022 11:27
Show store name on single product page (Sold by: vendor) when you have created single product via Elementor
/**
* Show sold by on single product page made with Elementor
* Add the shortcode [dokan_vendor_name] through a short-code widget on single product page
*/
add_shortcode( 'dokan_vendor_name', 'dokan_store_name_shortcode' );
function dokan_store_name_shortcode() {
$seller = get_post_field( 'post_author' );
$author = get_user_by( 'id', $seller );
$vendor = dokan()->vendor->get( $seller );
@woogists
woogists / wc-show-cart-contents-total-ajax.php
Last active December 31, 2023 10:08
[Theming Snippets] Show cart contents / total Ajax
/**
* Show cart contents / total Ajax
*/
add_filter( 'woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment' );
function woocommerce_header_add_to_cart_fragment( $fragments ) {
global $woocommerce;
ob_start();
@woogists
woogists / wc-show-cart-contents-total.php
Last active October 26, 2021 20:29
[Theming Snippets] Show cart contents / total
// Use in conjunction with https://gist.github.com/woogists/c0a86397015b88f4ca722782a724ff6c
<a class="cart-customlocation" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf ( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
@danielpataki
danielpataki / add-section.php
Last active February 5, 2021 09:32
Customizer Tutorial
$wp_customize->add_section( 'cd_colors' , array(
'title' => 'Colors',
'priority' => 30,
) );