woocommerce: change default setting > is_sold_individualy function
You can use a built-in function from WordPress: add_filter( ‘woocommerce_is_sold_individually’, ‘__return_true’ ); This line in a separate plugin will set the value always to true.
You can use a built-in function from WordPress: add_filter( ‘woocommerce_is_sold_individually’, ‘__return_true’ ); This line in a separate plugin will set the value always to true.
It mainly depends on a theme, whether there is a hook, in which you can call an action. Simple ways, how to do that: You insert your code directly into single.php, right above the code calling comments_template(), You create a hook (e.g. above comments_template()) as do_action(‘my_hook’) and then you hook into it your function add_action(‘my_hook’, … Read more
The second parameter for add_action() must be a function or a member of an object. In the second case you have to pass an array ( $object, ‘method_name’). To register the widget from within the class, add the following method to your widget class: /** * Tell WP we want to use this widget. * … Read more
What do you mean, “whatever I tried under ‘Permalinks’ didn’t work? Select “Shop with Category Base”. That adds the product category the single product URL. Don’t forget to choose something other than “default” under the Common Settings for permalinks.
As things like this are often requested, I’ve written a plugin named “Dynamic Image Resize”. It’s basically a plugin, but, due to it’s one-file approach, it can be used as mu-plugin or theme include without a problem. It’s main purpose is to resize single images on demand to a given height/width. These are the arguments … Read more
Got a solution: Just added functions to call each buttons in the ajax loading JavaScript file. $(document).ajaxComplete(function() { FB.XFBML.parse(); // For Facebook button. twttr.widgets.load(); // For Twitter button. gapi.plusone.go(); // For Google plus button. });
I think there’s no really huge difference, you choose the tool that you feel most comfortable yourself. Plugins have the drawbacks you mentioned, and doing them from scratch can be a bit slow and tedious. The 3rd alternative, that I find really good, is a PHP class that does all the heavy lifting for you, … Read more
You should first make sure that you don’t get any JavaScript errors. Plugin activations and edit buttons are using JavaScript and if your code has issues, it might break some portions of the website. Use Chrome Inspect to check it for JS errors.
WordPress 3.7 has an edit_form_top hook that may be what you need. add_action(‘edit_form_top’, ‘my_echo_function’); Though you will need to write logic to keep it from executing on any but the post-new.php page.
There is $woocommerce, which is is crucial. Several classes stored into this, see woocommerce class reference and additionally WC API Docs. If you’re looking for product information: $product = get_product( $post->ID ); is certainly a good entry point. If you’re already on a product page or generally in the wc loop, you often have $product … Read more