Skip to content

Instantly share code, notes, and snippets.

View alenb's full-sized avatar

Alen Birindzic alenb

View GitHub Profile
@WebEndevSnippets
WebEndevSnippets / functions.php
Created November 13, 2012 16:48
WooCommerce: Add Prefix to WooCommerce Order Number
add_filter( 'woocommerce_order_number', 'webendev_woocommerce_order_number', 1, 2 );
/**
* Add Prefix to WooCommerce Order Number
*
*/
function webendev_woocommerce_order_number( $oldnumber, $order ) {
return 'WE' . $order->id;
}
@chrisguitarguy
chrisguitarguy / no-toplevel-where.php
Created December 20, 2011 21:09
An example of how to use the posts_where filter in WordPress: don't allow any top-level parents posts into a query.
<?php
add_filter( 'posts_where', 'wpse29897_no_parents', 10, 2 );
function wpse29897_no_parents( $where, $query )
{
if( isset( $query->query_vars['post_type'] ) && 'city' == $query->query_vars['post_type'] )
{
if( '' != $where )
{
$where .= ' AND post_parent != 0';
}