Would put this in WP Stack Exchange, but often they say since it has PHP it should be in SO, so never quite sure where is best. Can move if more appropriate. To display a custom woocommerce product attribute called, “Fabrics” for example I’ve read you could do the following. However, is there a shorter way si…
Tag: wordpress
In WordPress where the content of text widget are stored?
In WordPress, when we make a text widget in the sidebar, is the content of the text saved in a variable or in the database? If it’s a variable, which variable is it? If it’s the database, which table is it? Any help is appreciated. Update: What I am trying to achieve is that I will make a plugin t…
Can not get the product details from order_id on the new order hook function
With WooCommerce, I have the following hook in my function.php after the new order is submitted: The above code is not giving me any output i’e it is not entering inside the foreach loop that’s why var_dump() not giving me any output, but if I mention the order_id specifically like create_job_open…
WordPress: wp-cron not working and not giving error in log
This is a wp-cron I defined in function.php file, but I don’t get any result in the error log, the event is in the cron list but if I launch it nothing happens. I have define(‘WP_DEBUG’, true); And error log enabled on all levels in php.ini Does anybody know where am I doing wrong? SOLUTION …
How can I check if a TERM is assigned with a POST using two parameters term slug and post ID?
I need to check whether a post has been assigned with a term but I do not have information about the taxonomy of that term as it could be any taxonomy present in my site. Answer You can have a custom function to return terms for all taxonomies: Then use it like:
How to start a php script from cli within wordpress
I wrote a PHP script, which was meant to be a WP-Cron-cronjob and which uses wordpress specific functions. Due to some restrictions in its runtime enviroment, I need to start this script from the command line with /usr/bin/php -q longThing.php instead of as a WP-Cron event. How can I ensure that all the wordp…
WooCommerce Retina Image Support – Not included in srcset
I’ve recently installed WP Retina 2x, and it generates the @2x images on my server. However, when using the PictureFill or WordPress Responsive methods, the srcset does not include any @2x images or 2x declarations: I should also mention that my media is stored on Amazon S3 using the S3 Offload Lite plu…
WooCommerce Check stock of product ID before adding
I have some custom code in my WooCommerce site that adds a product to the users cart. I already have it check the cart contents to make sure there is another product in the cart first, but I also …
Counting cart-items of specific product category
I am trying to get the number of items in the cart just from a specific product category in WooCommerce. I am doing a site for a winery. It has alcoholic and non-alcoholic products. All the wine falls under the main category of ‘wine’ or category id 34, with many subcategories and products underne…
Add an icon to custom WooCommerce payment gateway
I would like to add a custom icon to my payment gateway. I have read the WOO gateway API and have zero help. This is my code below. please help me find a functional way to include the icon so I have …