Skip to content

Instantly share code, notes, and snippets.

View mtx-z's full-sized avatar

Mtx Z mtx-z

View GitHub Profile
@mtx-z
mtx-z / wp-bootstrap4.4-pagination.php
Last active April 4, 2023 12:55
Wordpress 5.4 Bootstrap 4.4 pagination (with custom WP_Query() and global $wp_query support) (UPDATED for Bootstrap 5: https://gist.github.com/mtx-z/af85d3abd4c19a84a9713e69956e1507)
<?php
/**
* @param WP_Query|null $wp_query
* @param bool $echo
* @param array $params
*
* @return string|null
*
* UPDATE for Bootstrap 5.0: https://gist.github.com/mtx-z/af85d3abd4c19a84a9713e69956e1507
*
@mtx-z
mtx-z / wp-bootstrap5.0-pagination.php
Last active November 15, 2023 00:47
Wordpress 5.7 Bootstrap 5.0 pagination (with custom WP_Query() and global $wp_query support)
<?php
/**
* @param WP_Query|null $wp_query
* @param bool $echo
* @param array $params
*
* @return string|null
*
* Using Bootstrap 4? see https://gist.github.com/mtx-z/f95af6cc6fb562eb1a1540ca715ed928
*
@mtx-z
mtx-z / wp-woocommerce-edit-product-loop-thumbnail-template.php
Last active February 22, 2024 08:47
Woocommerce (3.8.1-6.2.2) edit product loop thumbnail template (allows to had/edit HTML outputted by Woocommerce to generate the product loop thumbnail image area, as there is no dedicated template file to override) - Wordpress / WooCommerce 3.8.1-6.2.2
<?php
/**
* Edit default Woocommerce product loop thumbnail template
* As there is no dedicated Woocommerce template (eg wp-content/plugins/woocommerce/templates/loop/price.php)
* because it's generated using filter, we must remove Woocommerce hook, and add our own "at the same place"
* to edit the product loop thumbnail template
* tested up to
* 14/07/2023 :
* Woocommerce 6.2.2
* 12/10/2020 :
@mtx-z
mtx-z / wp-woocommerce-allow-non-variation-attributes-frontend-selection.php
Last active March 31, 2024 17:02
Woocommerce: use non-variation attributes from frontend - allow customers to select term (option) from non-variation attributes on variable or simple products frontend pages, add selection to cart item, display it in cart, add it to order item
<?php
/**
* Inspired from: https://gist.github.com/dazecoop/548b2621e86fb030da8e5adb1bfe484f
*
* How to use:
* - add to your function.php or related
*
* What you can use it for:
* Variable products:
* - you have variable product with some attributes not used for variations