Skip to content

Instantly share code, notes, and snippets.

View Oxonium's full-sized avatar

Émilien Pierru Oxonium

View GitHub Profile
@Benoitlecorre
Benoitlecorre / algo_apb_proper.sql
Last active June 16, 2020 12:09
Code source d'Admission post-bac envoyé par le ministère de l'Education nationale
-- Génération automatique de classements aléatoires en production, pour les FNS
-- ===================================
FUNCTION gen_class_aiea_v1_relatif_grp( o_g_ea_cod_ins IN varchar2, o_g_ti_cod IN number, o_c_gp_cod IN number, o_g_tg_cod IN number, iogin IN varchar2, type_login IN number, mode_dev IN number, confirm IN number, saio IN number, nip IN varchar2, indic IN number, mess_err out varchar2, mess_aff out varchar2)
RETURN number IS
retour number;
X varchar2(2);
dummy number;
dummy2 number;
l_c_gp_fIg_seI c_grp.c_gp_flg_sel%type;
@bekarice
bekarice / wc-customer-csv-export-renaming-removing-reordering-columns.php
Created August 7, 2015 17:16
Rename, Re-order, or Remove columns from Customer CSV with WooCommerce Customer/Order CSV Export
<?php
/**
* These samples do not have to be used together
* They show how to rename, re-order, or remove columns
* from the exported customer CSV
*/
/**
* Rename Customer CSV Columns
* Sample: rename the customer_id column to User ID
@RadGH
RadGH / woocommerce-custom-cart-item-data.php
Last active April 27, 2024 17:25
Get and set custom cart item/product information prior to WooCommerce checkout, and carry those valus over to Order Item Metadata.
<?php
// UPDATE: Stefan from Stack Overflow has explained a better way to handle cart item data.
// See http://stackoverflow.com/a/32327810/470480
// ----------------------
/*
Instructions:
@corsonr
corsonr / gist:7370707
Created November 8, 2013 13:00
WooCommerce - display order coupons used in confirmation email and edit order page
add_action( 'woocommerce_email_after_order_table', 'add_payment_method_to_admin_new_order', 15, 2 );
/**
* Add used coupons to the order confirmation email
*
*/
function add_payment_method_to_admin_new_order( $order, $is_admin_email ) {
if ( $is_admin_email ) {
@mikeschinkel
mikeschinkel / find-in-set.php
Last active April 20, 2021 14:35
Adds FIND_IN_SET support as a comparison operator for WordPress meta_query. Include this in a plugin, in the theme's functions.php file, or as a separate file that is loaded using require() or include() before your call to WP_Query. As @Otto42 points out, you might not want to use this in a plugin that you plan to distribute given the WordPress'…
<?php
/**
* Class Add_Find_In_Set_Compare_To_Meta_Query
*/
class Add_Find_In_Set_Compare_To_Meta_Query {
/**
*
*/
function __construct() {
@webaware
webaware / gist:6260468
Last active June 6, 2023 18:00
WooCommerce purchase page add-to-cart with quantity and AJAX, without customising any templates. See blog post for details: http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/
<?php
/**
* start the customisation
*/
function custom_woo_before_shop_link() {
add_filter('woocommerce_loop_add_to_cart_link', 'custom_woo_loop_add_to_cart_link', 10, 2);
add_action('woocommerce_after_shop_loop', 'custom_woo_after_shop_loop');
}
add_action('woocommerce_before_shop_loop', 'custom_woo_before_shop_link');
@webaware
webaware / add-to-cart.php
Last active October 22, 2023 05:55 — forked from mikejolley/functions.php
WooCommerce purchase page add-to-cart with quantity and AJAX, by customising the add-to-cart template in the WooCommerce loop. See blog post for details: http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/
<?php
/**
* Loop Add to Cart -- with quantity and AJAX
* requires associated JavaScript file qty-add-to-cart.js
*
* @link http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/
* @link https://gist.github.com/mikejolley/2793710/
*/
// add this file to folder "woocommerce/loop" inside theme
@banago
banago / get-fisrt-paragraph.php
Created November 6, 2012 09:18
Get first paragraph from a WordPress post.
<?php
/**
* Get first paragraph from a WordPress post. Use inside the Loop.
*
* @return string
*/
function get_first_paragraph(){
global $post;
$str = wpautop( get_the_content() );
@schmidt1024
schmidt1024 / template-snippets.txt
Last active December 14, 2021 19:52
Template Snippets for Joomla!
# all php files :: disallow direct access of file
# between <?php and ?>
defined('_JEXEC') or die;
# index.php :: define variable with application
# between <?php and ?>
$app = JFactory::getApplication();
# index.php :: define variable with document
# between <?php and ?>
@boonebgorges
boonebgorges / gist:2185537
Created March 24, 2012 17:47
Recursively sort the output of get_categories() in order of parent-child hierarchy
<?php
$categories = get_the_category();
// Assemble a tree of category relationships
// Also re-key the category array for easier
// reference
$category_tree = array();
$keyed_categories = array();