Skip to content

Instantly share code, notes, and snippets.

View ahmadthedev's full-sized avatar

Muhammad Ahmad ahmadthedev

View GitHub Profile
@8ig8
8ig8 / remote-upload-image.php
Created April 17, 2012 03:50
How To Locally Mirror Remote Images With WordPress
<?php
/*
How To Locally Mirror Remote Images With WordPress
Source: http://forrst.com/posts/Locally_Mirror_Remote_Images_With_WordPress-XSE
*/
// URL of the image you want to mirror. Girl in pink underwear for instance.
$image = 'http://i.imgur.com/Hq4QA.jpg';
@mikejolley
mikejolley / gist:2044109
Last active April 10, 2024 13:17 — forked from jameskoster/header.php
WooCommerce - Update number of items in cart and total after Ajax
<?php
// Ensure cart contents update when products are added to the cart via AJAX (place the following in functions.php)
add_filter( 'woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment' );
function woocommerce_header_add_to_cart_fragment( $fragments ) {
ob_start();
?>
<a class="cart-contents" 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>
<?php