Categories
Snippets

add_menu_page supports decimal positions

When adding top level menu pages to WordPress admin (using add_menu_page) more often or not you’ll end up conflicting with other plugins. When two plugins share the same menu position, one is not shown:

WARNING: if 2 menu items use the same position attribute, one of the items may be overwritten so that only one item displays!

Since there are a limited number of integer positions in the menu this could be a problem, however, handily WordPress actually supports decimal positions. In this example I’m using ‘55.5’ instead of 55. This should reduce the risk of conflict significantly:

$main_page = add_menu_page(__('WooCommerce', 'woocommerce'), __('WooCommerce', 'woocommerce'), 'manage_woocommerce', 'woocommerce' , 'woocommerce_settings_page', null, '55.5' );

Note that the codex and the source state that integers should be used, even though the decimals do work. Kudos to Gary Jones for pointing this trick out.

Categories
Snippets

Finally fixed the flicker

Since developing my site’s theme there has always been this annoying browser bug causing a ‘flicker’ whilst rolling over any element with a css3 transition. I’ve finally found a decent workaround which involves adding 1 line of css:

-webkit-transform: translateZ(0);

This triggers the GPU to do the animation rather than the CPU and has fixed my flickering, as well as making the animation look smoother.

This line needs to go on the un-animated state, so in my case I applied it to the elements themselves rather than the :hover.

Kudos to Mauricio on Stack: http://stackoverflow.com/a/9727924

Categories
Links

WooCommerce Episode 1.5.5: Return of the Ninja

As well as a massive core update to WooCommerce itself (including drag and drop product sorting, extra theming settings and ShareYourCart integration) we’ve also released several plugins including PayPal Express, Force-Sells, and my own GoCardless gateway and Product CSV Import Suite.

http://zfer.us/kMa8w?d=http://www.woothemes.com/2012/05/woocommerce-episode-1-5-5-return-of-the-ninja/

Categories
Links

The WooCommerce Xmas Bundle

Don’t miss the offer we at WooThemes are running up to Christmas – 3 WooCommerce themes and 8 extensions (including Jay’s super cool responsive Argentum theme and the ever popular table-rate shipping extension) for just $150. If you’ve been waiting for the right moment to jump onto the WooCommerce bandwagon nows the time!

I’d like to close with a massive thank you to all of our contributors, users, supporters, and the WordPress community as a whole — Merry Christmas and a happy new year!
http://zfer.us/kMa8w?d=www.woothemes.com/woocommerce-xmas-bundle/

Categories
Snippets

WooCommerce – Output a simple, printable stock/inventory report

screen-capture-1

Another user request today to output a list of products, as well as their stock levels, to be used to compare the amount of real stock in hand with what WooCommerce thinks is in stock.

The code below can be added as a page template in your theme. Once added to your template, just create a page in WordPress admin and assign it the “Stock Report” page template.

Theres a check at the top of the page to only let admin users in, and when viewed the page will give you a simple list of products, SKU’s and stock levels which you can then print out.

I hope you find it useful 🙂

Categories
Snippets

Debugging with WP_DEBUG_LOG

The constant WP_DEBUG_LOG is something I’ve only recently discovered — when added to wp-config.php it enables a log of WordPress errors and notices to be saved to wp-content/debug.log.

define( WP_DEBUG_LOG, true );

This is very handy when debugging plugin errors, especially hidden ones like those which occur on plugin activation.

Categories
Snippets

WooCommerce: Output a printable list of processing orders

screen-capture

Someone requested a way to print out a list of their processing orders for WooCommerce so I came up with a snippet to do so 🙂

The code below can be added as a page template in your theme. Once added to your template, just create a page in WordPress admin and assign it the “Print processing orders” page template.

Theres a check at the top of the page to only let admin users in, and when viewed the page will give you a nice list of processing orders which you can then print out.

Categories
Posts

Say hello to WooCommerce; simple, beautiful WordPress eCommerce

Today I’m proud to announce WooCommerce has arrived. Its been a tough week preparing it’s launch, and a busy month of development work but its all paid off. The WooThemes team, myself included, are incredibly excited by its completion and we hope it’s a hit with the WordPress community as a whole.

WooCommerce is an open source eCommerce plugin for WordPress with loads of cool features. Adding products, managing orders, setting up tax and shipping rates – WooCommerce makes it easy.

Whilst developing WooCommerce we focused on extending core WordPress functionality and keeping the UI consistant; this gives you an simple, easy to use, familiar admin interface which is a joy to use.

We made full use of WordPress custom post types, post type archives, and custom taxonomies making it both extendable and easy to theme. Theme developers will be relieved by its simplicity – after using several other eCommerce plugins in the past I know that it will be a breath of fresh air to many.

Alongside the release of the WooCommerce plugin we’ve also released three new themes (WooStoreCoquette and Wootique) as well as several child themes and extensions.

WooTique is our free WooCommerce theme

You can read more about WooCommerce on the WooThemes site. Be sure to check out WooCommerce on WordPress.org, and if your a developer (or a translator) why not say hi on Github and contribute to the project 🙂

Categories
Posts

Working for WooThemes

Its been a fantastic (and busy) month for me – september 1st I started my new job at WooThemes, arguably the most popular premium WordPress theme company in town, and I’m having a blast 🙂

At WooThemes I’ve been busy working in the new ‘WooLabs’ division alongside my pal James Koster. In the WooLabs we’re focusing on application style themes (like SupportPress), plugins (our nearly complete Mighty Menus plugin) and the highly anticipated WooCommerce plugin and themes.

So far I’m really enjoying my new role at Woo, and I’m ecstatic that they gave me the opportunity to work with them.

I’ll leave you with this teaser…looking forward to tuesday!

Categories
Snippets

Getting comments of a certain post type

Whilst looking for a method to get comments from one of my post types in WordPress I stumbled across some undocumented parameters for the get_comments function. Simply state the name of the post type in the undocumented post_type parameter:

$comments = get_comments( array( 'number' => 5, 'status' => 'approve', 'post_status' => 'publish', 'post_type' => 'product' ) );

Very handy!