Woocommerce get cart total price in a number format [closed]

Update 2020 Answer See flytech’s answer for a solution using the native WooCommerce API. Note / Caveat If you’re going to do proper arithmetic with monetary values, always use signed integers (!) representing the smallest denomination of a given currency (Cent, Penny, Paisa, Dirham, e.g.). Only convert back to decimal fractions in the presentation layer … Read more

Get the category from an ID of a product?

Since the question is tagged woocommerce, i’m assuming that it’s a product CPT created by woocommerce wordpress plugin. This answer doesn’t apply if that’s not the case. The products categories is not normal categories, they are a custom taxonomy created specifically for products which is just labeled as “Categories”. You should go through the woocommerce … Read more

How can I create a bash install script for my WordPress sites setup (WP+plugins+theme)?

To always get latest plugin take for example my plugin: http://wordpress.org/extend/plugins/wordpress-file-monitor-plus/ the download link for the latest is: http://downloads.wordpress.org/plugin/wordpress-file-monitor-plus.1.1.zip but if you remove the version from the download link you always get the latest version: http://downloads.wordpress.org/plugin/wordpress-file-monitor-plus.zip EDIT: Have you considered keeping a folder of the latest wordpress and plugins unpacked? Then as soon as a … Read more

How to custom crop each image size?

You can customize or change WordPress image sizes using this function: http://codex.wordpress.org/Function_Reference/add_image_size <?php add_image_size( $name, $width, $height, $crop ); ?> The $crop parameter can be set to false for proportional or true for hard crop (it will hard crop from the center). If you use this function on already existing images you will need to … Read more

What’s a reliable way to depend on another plugin?

Consider plugin A: $A_message; add_action(‘plugins_loaded’, function() { do_action(‘plugin-A:init’); }); // Hooks allow B to access A (both during initialization of A and elsewhere in WordPress) without having to check if A exists. add_filter(‘plugin-A:set’, function($msg) { $A_message = $msg; }, PHP_INT_MAX); add_filter(‘plugin-A:get’, function($msg) { return $A_message; }, PHP_INT_MIN); Now, consider plugin B: add_action(‘plugin-A:init’, function() { // … Read more

How to include a plugin’s php file to another plugin functions file [duplicate]

The first error message means that there is restrictions in place on where you can include files from, set by the server. You could try with require_once ABSPATH . ‘/wp-content/plugins/pluginname/pluginfunctions.php’; but I’m not sure if it would work. With the second include you’re trying to include an URL which is disabled by the server for … Read more

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