I shouldn’t really be answering this, as third party plugins are off topic for this stack, but it’s a pretty simple fix.
The reason it’s happening is as you surmised because you’re using it outside of the Loop. You could solve it by running setup_postdata($post_id)
before you echo your products, but that doesn’t solve the deeper issue: if you’re running MySQL queries in a template you’re doing something very wrong (especially raw, unparameterized queries which are a huge security hole). I see no reason in the code above why you couldn’t use the WP_Query
class to fetch your data, which would be much safer and take care of setting up Post objects for you.
Related Posts:
- WordPress – estimate used product
- making users able to add their own products wp e-commerce [closed]
- A multi-section WordPress store [closed]
- How do I get WooCommerce to automatically recreate pages? [closed]
- Enabling free shipping on Woo Commerce by specific items [closed]
- WooCommerce – How to Add a Custom Field to Cart Items and Cart Totals [closed]
- Recommended eCommerce Plugin for a T-Shirt Sales Business? [closed]
- Automattic’s eCommerce Plugin
- Convert WordPress posts to products in WooCommerce
- Is there any site where i can found good documentation of wp-ecommerce plugin?
- WooCommerce – Adding Custom Order Without No Product [closed]
- WordPress shopping cart that supports 2 tier product variation options
- Is it possible to set up multistore in Woocommerce? [closed]
- MarketPress vs. other WP ecommerce solutions [closed]
- How To Hide Filters On Specific Categories with WooCommerce Products Filter(WOOF)
- Does a wordpress plugin (not a membership one) exist for selling access to some webpages? [closed]
- Where sales manager of WP-Commerce plugin?
- Only Homepage not loading properly
- Integrating non-WooCommerce and WooCommerce Orders together [closed]
- Add a captcha form to the woocommerce register form
- How to send an automated email to the customers when product is added woocommerce
- Product queue for my subscription box
- Want to Show Sub categories under Categories section using Woo Commerce [closed]
- wp e-commerce sort by stock [closed]
- Problems with migrating a WooCommerce orders [closed]
- WordPress User Post Products
- WordPress plugin Post Creation [closed]
- Let users sell video in my website [closed]
- Woocommerce – Change Variable Product Add to Cart to behave like external product using Custom Field (link) [closed]
- Replace woocommerce | (pipe) separator in product variation to , or another character?
- Hook functions for Wp e-commerce? [closed]
- WP-ecommerce : Change the price before inserting it into the cart
- Widget content turns up before title
- Using Amazon Book Gallery Plugins in WordPress [closed]
- What plugins can I use to feature (affiliate) products on my blog (from Amazon.com)?
- Permalinks and pagination are not working in WordPress with WP e-Commerce plugin
- How do I allow a user to purchase an expiring passcode to access part of my website, from my online store, similar to pay-per-view?
- One quantity for group of variations
- WooCommerce Checkout Issue specific to Instagram In-App Browser
- I would like to add a function that allows the customer to add multiples of the same product to their basket, how can I do this easily?
- Tracking sales/conversions in Woocommerce using Google Analytics
- Coupon Codes for product discount combined with conditional free shipping
- Woocommerce categories displayed on every category and shopping page
- How to make a website with two types of logins , Sellers and buyers?
- E-commerce-like solution [closed]
- TheCartPress plugin – Make every item in store unique
- WP e-commerce sales-view
- Selling Downloadable Products [closed]
- Can Shopp Commercial Plugin be hacked to display radio buttons instead of Dropdowns? [closed]
- Turning Existing Eccommerce Site into Multi-SIte
- Sell “create a post”, paid account for post creation
- WooCommerce product prices not showing up correctly [closed]
- Self-hosted Plugins & Themes store with auto-updates? [closed]
- Display out of stock products in WooCommerce [closed]
- WordPress Shipment
- claim a permalink and all sublinks in plugin
- How To Convert External Image URLs To Own Website’s Uploaded Images Automatically?
- Getting 400 Error in wordpress website
- Edit a page/post DB data?
- how to update WordPress plugins from external website with nodejs?
- How can i store cache of wordpress a database request without plugins?
- this code is fiven by chat-gtp but nothing match even I key in the value of a cell. help!
- WP FULL CALENDAR (NO NEXT ARTICLES DISPLAY)? [closed]
- Play an animated character video on click of a button or radio button selection only
- How do i fix this error?
- Stop the user if login from the cookies
- How to filter plugin search results in wp-admin plugin search page
- Vanilla javascript in custom gutenberg block not working
- disabled plugin and now wordpress won’t load
- How do i display the number of images on the “post screen”
- How to provide page_template path in custom plugin using WordPress
- WordPress User Registration/ Sign Up -> Able to take Paid Certification Courses & keep track of Completed Certificates
- How can I disable a plugin in Health Check mode if there’s a critical error?
- Prevent primary navigational menu from expanding during page load (WordPress / Astra Theme)
- Change weird Wp File structure
- Oxygen plugin wordpress stuck in loading sequence forever when trying to edit a page [closed]
- Redux Framework slides field – How Can i add new placeholder Filed? [closed]
- Create CPT on Ajax Call
- Woocommerce business card flyer design [closed]
- plugin doesn’t retrieve data from database
- LiteSpeed cache image Optimization
- Automatically create WooCommerce products page by just uploading the images [closed]
- Issues with creating user profile for a subscriber, but with different profile page and functionalities
- Multiple plugins settings of same developer into ONE settings page linked together
- Set the Social Icon Size in footer
- Use custom Javascript for a custom Elementor Widget [closed]
- Can’t save formdata in DB
- Block Root REST API Route using custom &/or iThemes
- Cannot register a block in my Twig-based theme using Timber for WP
- Event Made Easy – Block registration to two or more events that have the same category
- How to set an exact search box in tablepress plug-in
- Wp private content show me files attachments into post
- How to use `$order->get_discount_total()`, avoiding defoult WC decimal rounding?
- How can I wordpress cache a database request with no existing plugin?
- Save Confirmation Page Title to WPForms Entry
- Problem on a wordpress website with a plugin [closed]
- Allow manage_options capability for specific user only for specific plugin?
- Private plugin updating – GitHub zip file changes the plugin directory (with release or branch name)
- I want to allow certain file types on dokan upload files
- How do I edit the action URL on a widget form from a plugin?