You can use a filter to override the WooCommerce checkout fields that display, and also change their content. Here’s an example snippet of how to do that. Add it to your functions.php: // Customize Checkout Fields function custom_override_checkout_fields( $fields ) { $fields[‘billing’][‘billing_company’][‘label’] = ‘Organization’; $fields[‘billing’][‘billing_company’][‘required’] = true; $fields[‘billing’][‘billing_company’][‘placeholder’] = ‘Your Organization\’s Name’; $fields[‘order’][‘order_comments’][‘placeholder’] = ”; […]
Archive by Author
Remove WooThemes Author and Other Post Meta
Simple one, just add the following to your functions.php: // Remove post-meta function woo_post_meta( ) { } Twitter Facebook Google+ LinkedIn
Remove the Admin Bar From WordPress Public Side
Add the following snippet to your functions.php to remove the Admin bar from all logged in users except administrators: // Remove the admin bar function dont_show_admin_bar($content) { return ( current_user_can(“administrator”) ) ? $content : false; } add_filter( ‘show_admin_bar’ , ‘dont_show_admin_bar’); Twitter Facebook Google+ LinkedIn
Customize the WordPress RSS Feed For a Custom Post Type
Sometimes you want to customize the RSS Feed just for a custom post type, and leave the default alone. Here’s a snippet you can add to your functions.php that will allow you to do just that. You will need to add your custom-feed.php which you can base on one of WordPress’s default feed templates, found […]
Related Posts By Taxonomy
Here’s a useful function for displaying all of the related posts in a given taxonomy. I’ve used similar functions in the past in building a shortcode to display a list of the same custom post types that share a common taxonomy. function related_posts_by_taxonomy( $post_id, $taxonomy, $args=array() ) { $query = new WP_Query(); $terms = wp_get_object_terms( […]
Remove WordPress’s Automatic Paragraph Tag
Just add the following to your functions.php: // Remove automatic paragraphs remove_filter( ‘the_content’, ‘wpautop’ ); remove_filter( ‘the_excerpt’, ‘wpautop’ ); Twitter Facebook Google+ LinkedIn
Change the Default WordPress Display Name
When a new user registers, you can change the default population of the Display Name and make it, e.g., Firstname Lastname. Here’s a snippet you can add to your functions.php: // Set Display Name to Firstname Lastname function set_default_display_name( $user_id ) { $user = get_userdata( $user_id ); $name = sprintf( ‘%s %s’, $user->first_name, $user->last_name ); […]
Enable Shortcodes in Excerpts and Text Widgets
Just add the following to your functions.php: add_filter(‘the_excerpt’, ‘do_shortcode’); add_filter(‘widget_text’, ‘do_shortcode’); Twitter Facebook Google+ LinkedIn
Customize the WooCommerce Breadcrumb HTML Markup
The easiest way to do this is to override the woocommerce_breadcrumb function. Add something like the following to your functions.php (obviously add whatever changes you want to make to the markup in the appropriate places): // Customize the WooCommerce breadcrumb if ( ! function_exists( ‘woocommerce_breadcrumb’ ) ) { function woocommerce_breadcrumb( $args = array() ) { […]
How to Change the Placeholder Image in WooCommerce Within functions.php file
Simple: // Add a custom placeholder image location add_filter( ‘woocommerce_placeholder_img_src’, ‘custom_placeholder_img_src’); function custom_placeholder_img_src () { return ‘/assets/placeholder.png’; } Twitter Facebook Google+ LinkedIn