[Solved] WordPress 2.8 Widget API is suitable for Worpress 3.1.4 plugins development?

WordPress APIs usually refer to group of functions and concepts and are not versioned. Any versions refer to WP itself (or in some cases to bundled components, developed by third parties such as jQuery). In WordPress version 2.8 creating widgets was refactored from older code (which you shouldn’t care about) to newer class-based code (which … Read more

[Solved] How to properly use a hook to create template for custom product type in a plugin such as Woocommerce? [closed]

You may use an action in the format woocommerce_YOUR_PRODUCT_TYPE_add_to_cart to reach the goal. Here is the example. The following code is for putting in functions.php, if you are writing a plugin. Please remember to change the callback. eg. you have a product type called Special, you want to add the add-to-cart template for it. add … Read more

[Solved] Uninstall, Activate, Deactivate a plugin: typical features & how-to

There are three different hooks. They trigger in the following cases: Uninstall Deactivation Activation How-to trigger functions safely during the scenarios The following shows the right ways to safely hook callback functions that get triggered during the mentioned actions. As you could use this code in a plugin that uses plain functions, a class or … Read more

[Solved] What’s the preferred method of writing AJAX-enabled plugins?

the “safer and cleaner” way would be to use admin-ajax.php that comes with wordpress and wp_ajax hook to call your processing function from your plugin file and use wp-nonce to check the integrity of the call. for example: your ajax JQuery call would be <script type=”text/javascript” > jQuery(document).ready(function($) { var data = { action: ‘ACTION_NAME’, … Read more

[Solved] Where to put my code: plugin or functions.php?

I would start with this question: Is the functionality related to presentation of content, or with generation/management of content, or of the site, or of the user identity? If the functionality is not related specifically to presentation of content, then it is squarely within Plugin Territory. This list is long: Modifying core WP filters (wp_head … Read more