Skip to content

Instantly share code, notes, and snippets.

View hemusyl's full-sized avatar

Humayun Kabir hemusyl

View GitHub Profile
@hemusyl
hemusyl / add-to-cart.php
Created January 30, 2016 05:38 — forked from claudiosanches/add-to-cart.php
WooCommerce - Template add-to-cart.php with quantity and Ajax!
<?php
/**
* Custom Loop Add to Cart.
*
* Template with quantity and ajax.
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
global $product;
@hemusyl
hemusyl / functions.php
Created January 30, 2016 05:29 — forked from woogist/functions.php
Set a custom add to cart URL to redirect to
/**
* Set a custom add to cart URL to redirect to
* @return string
*/
function custom_add_to_cart_redirect() {
return 'http://www.yourdomain.com/your-page/';
}
add_filter( 'woocommerce_add_to_cart_redirect', 'custom_add_to_cart_redirect' );
@hemusyl
hemusyl / multiple-featured-image.php
Last active January 30, 2016 07:36
Multiple Featured Images in WordPress
@hemusyl
hemusyl / mini_cart.php
Last active January 28, 2016 14:58
Cart Item
// Collect from Trizzy wordpress theme
<?php global $woocommerce; ?>
<div id="cart">
<!-- Button -->
<div class="cart-btn">
<a href="#" class="button adc"><?php echo WC()->cart->get_cart_subtotal(); ?></a>
</div>
<div class="cart-list">
<div class="arrow"></div>
@hemusyl
hemusyl / gist:cce281d03c2d2d808bb0
Created January 27, 2016 08:16 — forked from webaware/gist:6260468
WooCommerce purchase page add-to-cart with quantity and AJAX, without customising any templates. See blog post for details: http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/
<?php
/**
* start the customisation
*/
function custom_woo_before_shop_link() {
add_filter('woocommerce_loop_add_to_cart_link', 'custom_woo_loop_add_to_cart_link', 10, 2);
add_action('woocommerce_after_shop_loop', 'custom_woo_after_shop_loop');
}
add_action('woocommerce_before_shop_loop', 'custom_woo_before_shop_link');
@hemusyl
hemusyl / wc-add-images-order-email-table.php
Last active January 22, 2016 15:01 — forked from bekarice/wc-add-images-order-email-table.php
Add images to WooCommerce emails
// Edit order items table template defaults
// https://www.sellwithwp.com/how-to-add-information-to-woocommerce-emails/
function sww_add_wc_order_email_images( $table, $order ) {
ob_start();
$template = $plain_text ? 'emails/plain/email-order-items.php' : 'emails/email-order-items.php';
wc_get_template( $template, array(
'order' => $order,
'items' => $order->get_items(),
@hemusyl
hemusyl / function.php
Created November 27, 2015 16:44
Option tree er function file
<?php
/**
* OptionTree Theme version
*/
define( 'OT_THEME_VERSION', '2.5.4' );
/**
* Register Theme Features
*/
function option_tree_theme_setup() {
@hemusyl
hemusyl / bootstraptab.php
Last active November 24, 2015 18:57
Tab Dynamic (Bootsrap tab)
http://wordpress.stackexchange.com/questions/192451/dynamic-bootstrap-tabs-with-post-title-doesnt-display-the-content?lq=1
<div id="tab">
<ul class="nav nav-tabs" role="tablist">
<?php $loop = new WP_Query( array( 'post_type' => 'candidates', 'posts_per_page' => -1 ) ); ?>
<?php
$counter = 0;
while ( $loop->have_posts() ) : $loop->the_post();
$counter++;
?>
<li role="presentation" class="post-<?php the_ID(); ?> <?=($counter == 1) ? 'active' : ''?>"><a href="#post-<?php the_ID(); ?>" aria-controls="home" role="tab" data-toggle="tab"><?php the_title();?></a></li>
@hemusyl
hemusyl / new_gist_file.php
Created November 14, 2015 18:47 — forked from nickberens360/new_gist_file.php
wordpress: Full dynamic bootstrap carousel code
<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<?php
$args = array(
'post_type' => 'slides1',
'orderby' => 'menu_order title',
'order' => 'ASC',
);
$query = new WP_Query( $args );
@hemusyl
hemusyl / carousel.js
Last active November 22, 2015 17:24
Carousel Active Class