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:[email protected]
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
How to display Woocommerce product price by ID number on a custom page?
https://stackoverflow.com/questions/30165014/how-to-display-woocommerce-product-price-by-id-number-on-a-custom-page
If you have the product's ID you can use that to create a product object:
$_product = wc_get_product( $product_id );
Then from the object you can run any of WooCommerce's product methods.
@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 / breadcrumbs-custom.php
Last active November 15, 2024 14:09
WordPress custom breadcrumbs without plugin
http://www.qualitytuts.com/wordpress-custom-breadcrumbs-without-plugin/
Step 1
Breadcrumbs are the important part of our website, in wordpress there are several plugins are available for this, but below i posted
the code for custom breadcrumbs for our wordpress site. Just add this below code in to your current wordpress theme functions.php
and call the second step.
<?php
function qt_custom_breadcrumbs() {