Hide prices and checkout functionality in woocommerce

luckily woocommerce has many hooks, this removes prices and buttons: remove_action( ‘woocommerce_after_shop_loop_item’, ‘woocommerce_template_loop_add_to_cart’ ); remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_price’, 10 ); remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_add_to_cart’, 30 ); remove_action( ‘woocommerce_after_shop_loop_item_title’, ‘woocommerce_template_loop_price’, 10 ); you can dig into content-product.php and content-single-product.php if you need to remove more stuff. I can imagine there’s more than just the prices/buttons you want to … Read more

Are WordPress Plugins essential?

##Plugin Necessity## What the necessity of plugins really boils down to is the question, “Am I satisfied that WordPress’s core functionality is all that I need?“ If all you want is a simple blog with some categories and a number of static pages you’re set. But if you want to start integrating interactive maps, calenders … Read more

wp.media.view.ImageDetails – Save settings as HTML5 data-* attributes for image

A way to do it is to use the (very convenient) editor:image-edit and editor:image-update events triggered by the tinymce wpeditimage plugin to get/set the dom directly (updated to wrap in wp_enqueue_media action): add_action( ‘wp_enqueue_media’, function () { add_action( ‘admin_footer’, function () { ?> <script type=”text/javascript”> jQuery(function ($) { if (wp && wp.media && wp.media.events) { … Read more

Proper Way to Modify Plugin

IMHO, the best approach is either to fork the Plugin to maintain your changes, or else submit patches to the Plugin developer, to have your changes made a part of the original Plugin. Creating a “Child Plugin” really isn’t easy. The “Child Theme” concept really applies to the template files that get used, moreso than … Read more

How to catch/what to do with a WP Error Object

Assign return of the function to the variable. Check the variable with is_wp_error(). If true handle accordingly, for example trigger_error() with message from WP_Error->get_error_message() method. If false – proceed as usual. Usage: function create_custom_post() { $postarr = array(); $post = wp_insert_post($postarr); return $post; } $result = create_custom_post(); if ( is_wp_error($result) ){ echo $result->get_error_message(); }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)