WordPress Development Tip of the Week

Since I joined Codeable.io as part of their in-house team my actual development time has dropped considerably. In my role I am mainly a part of the support team. However, I am still doing sufficient development however to come up with some tips, and so I thought I would post them. I can’t promise every week but I will do my best.

The WordPress Development Tip

If you are bringing in functionality from a plugin into your plugin and it isn’t needed in the admin (wp-admin) then make sure to apply it only in the frontend by using the !is_admin() conditional. And if it is needed in the backend, but the original plugin uses it in the frontend, then make sure to include whatever files are needed using include().

The Gotcha

This tip as I suspect most of my subsequent tips will come from a gotcha, something that catches me out. Well… Yesterday a friend asked me if I could help him to show the WooCommerce Instagram module (from the plugin of that name by WooCommerce — formerly WooThemes of course) show in a tab, instead of its own area hooked onto the woocommerce_after_single_product hook. I said of course and used the following code

The code worked perfectly, Instagram got its own tab on the single product view, and everyone was happy. Until we realised it had completely broken the backend product data panel because the WooCommerce_Instagram_Frontend wasn’t available in the backend.

A quick change to the code:

The Tip Applied

Like the code you see here? You can hire me at Codeable.io - a WordPress specialist outsourcing site that vets developers to make sure they are of the highest standard. See all developers you can hire through Codeable here.

Posted in Code Snippets, Featured, Guides, Help Topics and tagged , .

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.