Skip to content

Instantly share code, notes, and snippets.

View anhskohbo's full-sized avatar
🎯
Focusing

Van anhskohbo

🎯
Focusing
View GitHub Profile
<?php
/*
Extends Visual Composer
More information can be found here: http://kb.wpbakery.com/index.php?title=Category:Visual_Composer
*/
// don't load directly
@anhskohbo
anhskohbo / content-single-product.php
Created June 25, 2016 18:06 — forked from georgybu/content-single-product.php
WooCommerce - Show next\prev products from current product category (when viewing a single product) 1. If product is last -> Next product is first 2. If product is first -> Prev product is last forked from https://gist.github.com/2176823 (This question was in http://stackoverflow.com/questions/13597687/woocommerce-get-next-previous-product/13612387
<?php
// get next and prev products
// Author: Georgy Bunin (bunin.co.il@gmail.com)
// forked from https://gist.github.com/2176823
function ShowLinkToProduct($post_id, $categories_as_array, $label) {
// get post according post id
$query_args = array( 'post__in' => array($post_id), 'posts_per_page' => 1, 'post_status' => 'publish', 'post_type' => 'product', 'tax_query' => array(
array(
'taxonomy' => 'product_cat',
@anhskohbo
anhskohbo / Laravel-Container.md
Created April 3, 2018 15:02
Laravel's Dependency Injection Container in Depth

Laravel's Dependency Injection Container in Depth

Laravel has a powerful Inversion of Control (IoC) / Dependency Injection (DI) Container. Unfortunately the official documentation doesn't cover all of the available functionality, so I decided to experiment with it and document it for myself. The following is based on Laravel 5.4.26 - other versions may vary.

Introduction to Dependency Injection

I won't attempt to explain the principles behind DI / IoC here - if you're not familiar with them you might want to read What is Dependency Injection? by Fabien Potencier (creator of the Symfony framework).

Accessing the Container