It could be anything, but if you’re offering a service of some kind, rather than a simple downloadable product, you may need to trigger something to happen when an order is complete. Here’s a simple snippet illustrating how you can add an action to woocommerce_payment_complete. Add something like the following to your functions.php. You’ll need […]
Archive | Snippets
RSS feed for this sectionRemove page numbers from wp_head for post type archives with WordPress SEO
If you’ve got WordPress SEO enabled this can be a tricky one. Took a while to track down exactly where those /page/2s were being added to my custom post type archive. I removed get_pagenum_link and start_post_rel_link and finally figured out the culprit was WordPress SEO! Just add something like the following to your functions.php // […]
WordPress Username Restrictions without a Plugin
On a recent project my client needed WordPress username restrictions but didn’t want to use a plugin. There are a few plugins out there that allow username restrictions but they are a bit overkill for this project and so I decided to just implemented it via a snippet in functions.php. Basically, there’s a list of […]
No Nonsense WordPress Logout Link Without a Plugin
Add this WordPress Logout Link snippet and any logged in user can just go to /logout/ and they will be logged out: // WordPress Logout Link function wpbase_logout_redirect() { $path = $_SERVER[‘REQUEST_URI’]; if ( !is_user_logged_in() ) { return; } // Allow Logged in Users to Log out from /logout/ if (preg_match(“~/logout~”, $path) or is_page(‘logout’)) { […]
Where is the MySQL Dump File in BackupBuddy Full Backup?
When you download your BackupBuddy backup to your local machine it’s not immediately obvious where the MySQL database dump is located. To find it, extract the ZIP file and look for the following folder : wp-content/uploads/backupbuddy_temp/MYSERIALCODE. The MYSERIALCODE part will match the backup name serial code. Hope that’s helpful!
How To Get Rid of the Admin Notice Install the WooThemes Updater plugin to get updates for your WooThemes plugins
If you’re running WooCommerce plugin extensions but aren’t and don’t want to use their updater, you can remove the notice Install the WooThemes Updater plugin to get updates for your WooThemes plugins that appears on every admin page by adding the following to your functions.php // Remove WooCommerce Updater remove_action(‘admin_notices’, ‘woothemes_updater_notice’);
Remove Inline CSS from Query Multiple Taxonomies
Add to functions.php: / Don’t show the inline css for wp-query-multiple-taxonomies remove_action(‘wp_head’, array(‘QMT_Hooks’, ‘wp_head’));
Add Twitter Bootstrap Icons to Widget Titles in WordPress
Best option I’ve found is via a shortcode. Open your functions.php in your favorite text editor and first enable shortcodes for widget titles: add_filter(‘widget_title’, ‘do_shortcode’); Then, add your shortcode with the icon: add_shortcode(‘iconthlist’, ‘wpbase_iconthlist’); function wpbase_iconthlist() { return ‘<i class=”icon-th-list”></i>’; }
How to change the placeholder image for WooCommerce
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’; }
Enable Author Archives for Customers in WooCommerce
Add the following to snippet your theme’s functions.php file: /** * Revert WooCommerce “Disable author archives for customers.” ‘feature’ */ function remove_wc_disable_author_archives_for_customers() { remove_action( ‘template_redirect’, ‘wc_disable_author_archives_for_customers’, 10 ); } add_action( ‘after_setup_theme’, ‘remove_wc_disable_author_archives_for_customers’);