Skip to content

Instantly share code, notes, and snippets.

//Register custom sidebar
function theme_slug_widgets_init() {
register_sidebar( array (
'name' => __( 'Custom Sidebar', 'theme_slug' ),
'id' => 'custom_sidebar',
'before_widget' => '<aside id="%1$s" class="widget %2$s" role="complementary">',
'after_widget' => "</aside>",
'before_title' => '<h4 class="widget-title">',
'after_title' => '</h4>',
));
//Update the excerpt length
function new_excerpt_length($length) {
return 100; // 100 Words
}
add_filter('excerpt_length', 'new_excerpt_length');
// Override default theme option for the number
// of products in a row on archive pages.
function products_per_row() {
return 3; // 3 products per row
}
add_filter('loop_shop_columns', 'products_per_row', 999);
/*
*** Order Status Options ***
>> woocommerce_order_status_pending
>> woocommerce_order_status_failed
>> woocommerce_order_status_on-hold
>> woocommerce_order_status_processing
>> woocommerce_order_status_completed
>> woocommerce_order_status_refunded
>> woocommerce_order_status_cancelled
@wisecrab
wisecrab / wordpress-send-email.php
Last active August 29, 2015 14:28
A simple function and variable set group to send an email from WordPress.
$to = 'email@example.com';
$subject = 'This is the email subject';
$message = 'Here is my email message.';
$headers = 'From: My Name <myname@example.com>' . "\r\n";
$headers .= "Reply-To: myname@example.com \r\n";
$attachments = '';
wp_mail( $to, $subject, $message, $headers, $attachments );