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;
<?php
global $paged;
$posts_per_page = 9;
$settings = array(
'showposts' => $posts_per_page,
'post_type' => 'portfolio',
'orderby' => 'menu_order',
'order' => 'ASC',
'paged' => $paged)
);
@hemusyl
hemusyl / tabbed_taxonomy.php
Last active May 9, 2016 18:05 — forked from FernE97/tabbed_taxonomy.php
PHP: WordPress custom taxonomy/post query
<?php
$args = array(
'orderby' => 'ID'
);
$terms = get_terms( 'testimonial_category', $args );
?>
<!-- bootstrap tabs -->
<ul class="nav-tabs">
<?php
@hemusyl
hemusyl / method-overlap.php
Created January 25, 2017 21:20 — forked from nahid/method-overlap.php
This gist is for PHP traits Example
<?php
trait Greetings
{
public function sayHello()
{
return 'Hello Bro';
}
public function goodBye()
@hemusyl
hemusyl / index.php
Created March 12, 2017 06:30 — forked from jameskoster/index.php
WooCommerce - Sample products loop
<ul class="products">
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 12
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post();
wc_get_template_part( 'content', 'product' );
@hemusyl
hemusyl / Wordpress featured images expanded
Created April 13, 2017 16:03 — forked from austinginder/Wordpress featured images expanded
Wordpress adding multiple featured images per post
@hemusyl
hemusyl / single-page-walker.php
Created May 15, 2017 03:23 — forked from ninnypants/single-page-walker.php
Nav walker for single page WordPress sites
<?php
class Single_Page_Walker extends Walker_Nav_Menu{
function start_el(&$output, $item, $depth, $args) {
global $wp_query;
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$class_names = $value = '';
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
$classes[] = 'menu-item-' . $item->ID;
@hemusyl
hemusyl / even_odd_classes.php
Created May 15, 2017 09:10 — forked from gregrickaby/even_odd_classes.php
Even odd classes in WordPress loop
<?php
// WP_Query Arguments
$args = array(
'order' => 'DESC',
'posts_per_page' => 5
);
// The Loop
$query = new WP_Query( $args );
@hemusyl
hemusyl / odd-even-postclass.php
Created May 16, 2017 11:12 — forked from neilgee/odd-even-postclass.php
Odd/Even Post Class in WordPress
<?php //<~ dont add me in
add_filter( 'post_class', 'themeprefix_odd_even_classes' );
function themeprefix_odd_even_classes( $classes ) {
global $wp_query;
if($wp_query->current_post % 2 == 0) {//http://stackoverflow.com/questions/7959247/php-test-if-number-is-odd-or-even
$classes[] = 'odd';
}
@hemusyl
hemusyl / project-topic.txt
Created September 24, 2018 07:47 — forked from humayunahmed8/project-topic.txt
Project Topic
## table of contents:
=====================
1. Basic Php
2. Install WordPress in live server
2.1. WordPress Dashboard Introduction
3. Introduce about IDE & WordPress template hierarchy
4. Introducing about Visual Composer
4.1. Visual Composer academy site
4.2. Use Visual Composer Element/Addons