I’m trying to restrict content on the page via shortcode for those who purchased a particular woocommerce product. I tried using the code below but it’s not working – shortcode [wcr pid=”78] this is some text [/wcr] is just being outputted on the page without hiding the content. Woocommerce has a function for restricting content like this. Answer There is
Tag: shortcode
WooCommerce product additional information shortcode
I am new to WooCommerce and am looking for a solution to display Product attributes on a post page. I’ve made research and some test but nothing seems to work. Ideally, I would like to use a …
Check if WooCommerce product (simple or variations) are in stock and display label as shortcode
I would like to have a shortcode that I can add to a WooCommerce product page. The shortcode would simply check the product stock and say “In stock” if it has any. And then “Out of stock” if the product (or any of the variations) don’t have inventory. This shortcode should work for both Simple products and Variable products. With
How to get all tags from WordPress page/post as a list in shortcode?
At the end of each page and every post, I would like to output the tags as a list in a shortcode. Unfortunately, I do not know much about PHP, but someone who can understand will definitely be able to correct my mistake using the code below. Thank you in advance! Answer The method needs to return a string to
Nested shortcode to dynamically display WooCommerce products category
I am attempting to display a WooCommerce product category page based on the current user role. I have created a custom function get_user_role() to get the user role and added the shortcode [user_role]…
Get WooCommerce featured products with a custom shortcode
I tried to get array of featured products to use theme in my own plugin with jquery slider I have made this function and get attrs from class-wc-shortcodes.php but no results what I must add or change to get it works I use it now as shortcode in welcome page just for testing Answer There was some errors in your
WordPress strip single shortcode from posts
I want to strip just the shortcodes in my blog posts. The only solution I found is a filter that I added to my functions. It removes all shortcodes including which I need for images. How can I specify a single shortcode to exclude or include? Answer To remove only the gallery shortcode , register a callback function that returns
Problem return a function inside of a shortcode in WordPress
I have some trouble coding a themes shortcode. I want the code to display a div with a view counter function, and then a link with the shotcodes content as the url. The view_count(); function works fine when called inside theme files, and I actually managed to make it show, but then it displayed before the_content(); of the post (the