Skip to content

Instantly share code, notes, and snippets.

View alexx855's full-sized avatar
🔵
Stay safe and stay optimistic.

Alex Pedersen alexx855

🔵
Stay safe and stay optimistic.
View GitHub Profile
@bekarice
bekarice / wc-change-price-display-custom-field.php
Created January 4, 2016 00:48
Change WooCommerce price display with a custom field
<?php
// only copy the opening php tag if needed
// Change the shop / product prices if a unit_price is set
function sv_change_product_html( $price_html, $product ) {
$unit_price = get_post_meta( $product->id, 'unit_price', true );
if ( ! empty( $unit_price ) ) {
$price_html = '<span class="amount">' . wc_price( $unit_price ) . ' per kg</span>';
}
@jameskoster
jameskoster / functions.php
Created June 1, 2015 09:14
Storefront - add primary navigation wrapper
add_action( 'storefront_header', 'jk_primary_navigation_wrapper', 45 );
add_action( 'storefront_header', 'jk_primary_navigation_wrapper_close', 65 );
function jk_primary_navigation_wrapper() {
echo '<section class="jk-primary-navigation">';
}
function jk_primary_navigation_wrapper_close() {
echo '</section>';
}
@WebEndevSnippets
WebEndevSnippets / functions.php
Created November 13, 2012 16:30
WooCommerce: Change Order Notes Placeholder Text
add_filter( 'woocommerce_checkout_fields', 'webendev_woocommerce_checkout_fields' );
/**
* Change Order Notes Placeholder Text - WooCommerce
*
*/
function webendev_woocommerce_checkout_fields( $fields ) {
$fields['order']['order_comments']['placeholder'] = 'Your custom placeholder';
return $fields;
}
@CodeNegar
CodeNegar / gist:3888311
Created October 14, 2012 11:36
PHP: Wordpress change logout redirect url
<?php
add_filter( 'logout_url', 'custom_logout_url' );
function custom_logout_url( $default )
{
return add_query_arg('redirect_to', get_bloginfo('url'),$default);
}
?>