Skip to content
Advertisement

Tag: wordpress

Several issues when using woocommerce_get_availability hook

Im trying to show an ‘out of stock message’ on the single product page for products that are out of stock. I have this code in my functions.php I get the following error: Notice: stock was called incorrectly. Product properties should not be accessed directly. Backtrace: require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/plugins/woocommerce/templates/single-product.php’), wc_get_template_part, load_template, require(‘/themes/mytheme/woocommerce/content-single-product.php’), do_action(‘woocommerce_single_product_summary’), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_template_single_add_to_cart, do_action(‘woocommerce_simple_add_to_cart’), WP_Hook->do_action, WP_Hook->apply_filters, woocommerce_simple_add_to_cart,

Increment variable date in PHP

I am grabbing the post published date (WordPress) and trying to add 2 days to it to create a post expiry date. But I am throwing the following error: Notice: A non well formed numeric value encountered Here is my code: Can anyone point out my error here please? Answer When using slashes to separate your date parts PHP assume

Posts not ordering by post__in

I am trying to display 3 blog posts that have been selected by the user in the admin. The order should go gridItem1, gridItem2 then gridItem3. I have set out my query below but it shows the selected posts but in date order not in the order I have outlined. I have searched other posts and added in the ‘surpress_filters’

Modifying URLs on a WP webpage depending on the incoming request URL parameters

I have a specific task where I have to alter the URLs contained within a WP webpage, based on the parameter of the incoming URL request. Let’s say I have a webpage https://example.com/prefix, on that page, there are several links that point to another page, say https://example2.com/prefix So whenever someone gets redirected to https://example.com/prefix with a certain URL parameter, let’s

Advertisement