WooCommerce reviews + tutorials

How to Create a WooCommerce Widget

…ate each setting individually. public function update( $new_instance, $old_instance ) { $instance[‘setting1’] = strip_tags( $new_instance[‘setting1’] ); $instance[‘setting2’] = strip_tags( $new_instance[‘setting2’] ); return $instance; } Our shipping plugin will look like this: public function update( $new_instance, $old_instance ) { $instance[‘title’] = strip_tags( $new_instance[‘title’] ); $instance[‘text’] = strip_tags( $new_instance[‘text’] );…

Read More

WooCommerce extension updates & releases

WooCommerce Social Login 2.0

…works don’t ever even provide an email address to our plugin — Twitter and Instagram are the major ones that do not provide email addresses. As a result, unlinking Twitter or Instagram accounts could result in duplication. This is for security: while we can assume an email address represents a unique person, we can’t assume a Twitter handle or Instagram username represents a unique person, so once unlinked from an account, we could never re-link t…

Read More

WooCommerce extension updates & releases

WooCommerce Memberships 1.7: Member emails, New Plan Options, and more

…bsite itself: WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, configure multisite installs and much more, without using a web browser. WooCommerce added support for WP-CLI in v2.5 – there’s an extensive set of commands which you can use to manage your WooCommerce installation, including orders, products, coupons and more. Memberships WP-CLI is built on top of the WooCommerce WP-CLI implementation…

Read More

WordPress development tutorials

Translating a WordPress Plugin on the Command Line Step by Step

…ctions, as well as ones specialized for use with HTML attribute values for instance. You should also use an appropriate text domain string based on your plugin name. If your plugin is called My-Plugin, your text domain might be ‘my-plugin’ for instance. Step 2 – Extraction If you have not already done so, start by exporting the WordPress translation tools: [bash]$ svn export http://i18n.svn.wordpress.org/tools/trunk/[/bash] Update 2013.03.01: It l…

Read More

WooCommerce reviews + tutorials

Widgets, Part Deux: Create a Smart WooCommerce Widget

…ocommerce_template_single_meta() to do so. public function widget( $args, $instance ) { // Only show this if we’re looking at a product page if ( ! is_singular( ‘product’ ) ) { return; } // get the widget configuration $title = $instance[‘title’]; echo $args[‘before_widget’]; if ( $title ) { echo $args[‘before_title’] . wp_kses_post( $title ) . $args[‘after_title’]; } // Show the product meta woocommerce_template_single_meta(); echo $args[‘after_w…

Read More

Pagely staging site

How to create a Pagely staging site (for the non-developer)

…is being created, you’ll have to wait a few minutes for the new site to be installed. Once it’s installed, you’ll have a temporary Pagely domain for it (something like http://s12345.p123.sites.pressdns.com). You can access the information for you app by going to “Sites” to get your site list, and clicking “App Details”. You’ll then see your temporary Pagely URL on this page: Make a note of your temporary domain as well as the name you gave your si…

Read More

Guide to Migrating Your Plugin to WooCommerce 2.0

…s. With 2.0 the WC_Product class is made abstract, meaning that to try and instantiate it is to be hit with a Fatal Error. The fix is to use the new product factory class to retrieve a new product instance, which you can do in a forwards/backwards compatible manner like so: /** * Gets the identified product. Compatible with WC 2.0 and backwards * compatible with previous versions * * @param int $product_id the product identifier * @param array $ar…

Read More

WP Development

Extending the WordPress XML-RPC API

…epend your method name with an identifier unique to you/your business. For instance, core WordPress methods begin with a ‘wp’ prefix (ie ‘wp.getCommentCount’), here I’ve scoped ‘helloWorld’ with ‘frs’ for “fox run software”, giving me a complete method name of “frs.helloWorld”. A simple implementation of the callback method follows: function hello_world( $params ) { global $wp_xmlrpc_server; $blog_id = (int) $params[0]; // not used, but follow in…

Read More

Moving WooCommerce Upsells on Product Pages

…dget space. You can view the complete code here — click “Download Zip” and install this as a plugin if desired, or checkout the gist to modify it further for your own plugin. The Results: A WooCommerce Upsells Widget Let’s have a look at a comparison. When the upsells are originally displayed, they’ll be shown below the main description. Upsells: regular display Now I’ll install my upsells widget plugin, and add it to my sidebar. New Upsells widge…

Read More

WP Development

Debugging WordPress

…s( $obj ) ); Example logging a stacktrace (if my WP Debug Helper plugin is installed and active): error_log( wp_debug_backtrace() ); Example var dumping a variable (if my WP Debug Helper plugin is installed and active): error_log( wp_var_dump( $foo ) ); Dump all defined constants (note that this will be quite extensive within WordPress): error_log( print_r( get_defined_constants(), true ) ); Dump all available globals (note that this will be quite…

Read More