Skip to content

Instantly share code, notes, and snippets.

@bhwebworks
bhwebworks / Embed Gists with a URL
Last active October 14, 2023 14:38
Add to functions.php or a mu-plugin
/**
* Embed Gists with a URL
*
* Usage:
* Paste a gist link into a blog post or page and it will be embedded eg:
* https://gist.github.com/2926827
*
* If a gist has multiple files you can select one using a url in the following format:
* https://gist.github.com/2926827?file=embed-gist.php
*
@stuartduff
stuartduff / woocommerce-dynamic-pricing-display-discount-table.php
Last active August 17, 2021 05:57
WooCommerce Dynamic Pricing display a table of dynamically generated discounts above the add to cart button http://cld.wthms.co/1ksKo/4u9gVw0f
add_action( 'woocommerce_before_add_to_cart_button', 'sd_display_bulk_discount_table' );
function sd_display_bulk_discount_table() {
global $woocommerce, $post, $product;
$array_rule_sets = get_post_meta( $post->ID, '_pricing_rules', true );
if ( $array_rule_sets && is_array( $array_rule_sets ) && sizeof( $array_rule_sets ) > 0 ) {
@verticalgrain
verticalgrain / wordpress-json-cheatsheet.md
Last active November 23, 2023 10:00
Wordpress JSON API Cheat Sheet

POSTS:

Get a post by id:

http://mixmeals.com/wp-json/wp/v2/posts/?filter[p]=12

Get multiple posts by id:

http://mixmeals.com/wp-json/wp/v2/posts/?include=470,469