Skip to content

Instantly share code, notes, and snippets.

<?php
/*
Plugin Name: woocommerce modal variationn
Plugin URI: #
Description: show modal window with product variations after clicking -add to cart-.
Version: 0.1
Author: Maks Buriy
Author URI: mailto:byymster@gmail.com
License: GPL2
*/
<?php
add_action( 'init', 'my_theme_custom_post' );
function my_theme_custom_post() {
register_post_type( 'agent',
array(
'labels' => array(
'name' => __( 'Agents' ),
<?php
global $post;
$terms = get_the_terms( $post->ID, 'product_cat' );
foreach ($terms as $term) {
$product_cat_id[] = $term->term_id;
break;
}
print_r (array_filter( array_unique( $product_cat_id ))) ;
@hemusyl
hemusyl / get-woocommerce-categories.php
Last active September 5, 2019 22:26 — forked from rajeebbanstola/get-woocommerce-categories.php
Simple way to fetch WooCommerce Categories with Image and Description
https://stackoverflow.com/questions/21009516/get-woocommerce-product-categories-from-wordpress
https://stackoverflow.com/questions/38288298/cant-get-category-object-in-some-templates-of-woocommerce?noredirect=1&lq=1
<?php
$get_featured_cats = array(
'taxonomy' => 'product_cat',
'orderby' => 'name',
'hide_empty' => '0',
'include' => $cat_array
);
function woocommerce_cart_link() {
global $woocommerce;
?>
<a href="<?php echo esc_url($woocommerce->cart->get_cart_url()); ?>" title="<?php echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count);?> <?php _e('in your shopping cart', 'woothemes'); ?>" class="cart-button ">
<span class="label"><?php esc_html_e('My Basket:', 'woothemes'); ?></span>
<?php echo esc_html($woocommerce->cart->get_cart_total()); ?>
<span class="items"><?php echo sprintf(_n('%d item', '%d items', $woocommerce->cart->cart_contents_count, 'woothemes'), $woocommerce->cart->cart_contents_count); ?></span>
</a>
<?php
}
<?php
/*
Plugin Name: Ninja Table Dynamic Data
Description: Dynamic Data Example For Ninja Tables
Version: 1.0.0
Author: WPManageNinja Shahjahan Jewel
Author URI: https://wpmanageninja.com/
Plugin URI: https://wpmanageninja.com/downloads/ninja-tables-pro-add-on/
License: GPLv2 or later
Text Domain: ninja_table_dynamic_data
@hemusyl
hemusyl / google-maps-shortcode.php
Created September 24, 2018 07:48 — forked from humayunahmed8/google-maps-shortcode.php
Google Maps shortcode
<?php
function stock_styled_map_shortcode($atts, $content = null) {
extract( shortcode_atts( array(
'lat' => '40.7433379',
'lng' => '-74.0103219',
'title' => esc_html('Head Office', 'stock-toolkit'),
'desc' => esc_html('House 21, Grand St. New York, USA', 'stock-toolkit'),
'height' => '500',
), $atts) );
@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
@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 / 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 );