I’m using shortcode to display all sold out WooCommerce items on a WordPress page. It works fine, except for throwing an error: I figure that this means array_filter() expects an array, but is given null from the following code in my functions.php: Shortcode: [out_of_stock_products] Here’s the WooCommerce function that expects the array but is given null: I’m not sure how
Tag: shortcode
Call to a member function get_items() on boolean in WooCommerce thankyou
I am trying to get order details to display a summary on my thank you page. The issue I am having is that this code snippet I have is breaking my wordpress. I have the stacktrace but I am unsure on how to fix it. The code to me looks correct so ensure why it’s not working. Does anybody have
WordPress video shortcode adds “?_=2” to the end of my src option
Has anybody had this experience? My WordPress (WordPress 5.4.2 running Twenty Seventeen Child theme) has an XYZ Code Snippet that echoes but somewhere in the process, a four character string is added to the end of the src so that I get Media error: Format(s) not supported or source(s) not foundDownload File: https://mywebsite/wp-content/uploads/securepdfs/C0112.mp4?_=2 when the page renders. Answer The problem
How to include JS in Contact Form 7 In WordPress
I have this piece of code mine that i have problem with. I hope you guys can help me on this matter. What i want to do here is to validate the [input text] of Contactform 7 that user can type only number’s on the input. I have this as the reference Including JS to Contact Form 7 Wordpress on
Get a product from specific product attribute term name in WooCommerce
I’m trying to create a WooCommerce shortcode to display one product with some information. Every day there is a new product with attribute DAGAANBIEDING and value JA or NEE. I only want to show that …
How can we display current user display name with shortcode?
I got this shortcode function to work to show current user display name, but now for some reason it is displaying the user’s first name. Is there another way to get current user’s display name and output it with shortcode? Answer If you go to a user’s profile (User’s > All users > search for the user you want) then
Return URL query into post shortcode from functions.php in WordPress
I am able to get the shortcode to return the string ‘evs’ inline in post [ when I plug that in to return ] but unable to return the post thumb url, using the same shortcode from functions.php What am I doing wrong here: Been stuck on this for ages now – please save my week ! Answer You are
Creating a List of Available WooCommerce Coupon Codes and Display anywhere Using Shortcode
I am trying to generate a list of available coupons and to display them using a shortcode. I was hoping to generate the list using SQL and not “-1” since that’s heavier on the db from what I …
Add custom field inside a do_shortcode
I’m trying to add a contact form into a page template with contact form 7. However, I want the destination email to come in from a custom field I have created. The code that pulls the custom field …
Shortcode from ACF Default Value only working after post is saved
I have this shortcode which is saved in the Default Value text field of an ACF field. The field type is Wysiwig editor. I get the Default Value text by using acf_get_field(‘location_info’)[‘…