Archive | Snippets

RSS feed for this section

My Personal Collection Of Tips, Tricks and WordPress Best Practices

How To Get Rid of the Admin Notice Install the WooThemes Updater plugin to get updates for your WooThemes plugins

04 May

If you’re running an older version of WooCommerce 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’); Twitter Facebook […]

Where is the MySQL Dump File in BackupBuddy Full Backup?

01 May

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! Twitter Facebook Google+ LinkedIn

No Nonsense WordPress Logout Link Without a Plugin

28 April

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 sozot_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’)) { […]

Remove page numbers from wp_head for post type archives with WordPress SEO

23 April

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 // […]

Looking for a WordPress Subscription Plugin? You Likely Need Several Plugins

21 April

Many of you have asked how to quickly set up a premium WordPress subscription membership site that supports limiting access to content for paying subscribers. The fastest way to go, without doing any programming or hiring a developer is to use a combination of free and premium WordPress tools. In this How To, I’ll quickly […]

How to Hook Into WooCommerce to Trigger Something After an Order is Placed

14 April

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 […]

How To Avoid Browser Security Errors And Embed YouTube Videos Properly On Your SSL WordPress Site

12 April

This is hopefully going to be fixed in core soon, but if you’re running into this problem, the solution is to add the following functions to functions.php: // Enbed YouTube Videos over SSL wp_oembed_add_provider(‘#https://(www\.)?youtube.com/watch.*#i’, ‘http://youtube.com/oembed?scheme=https’, true); wp_oembed_add_provider(‘https://youtu.be/*’, ‘http://youtube.com/oembed?scheme=https’, false ); Twitter Facebook Google+ LinkedIn

Customize WooCommerce Checkout Fields

11 April

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’] = ”; […]