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
- Sort plugins by rating
- How to Delete All regenerated thumbnails but keep the original ones?
- Why do I get this “plugin does not have a valid header” error?
- if plugin is active? check if plugin is enabled or not?
- A Blog’s changelog
- Adding a widget programmatically
- Updating a WordPress plugins breaks SVN
- Seeking clarification on page request life-cycle
- How do you install the automattic developer plugin under localhost for mamp when there is an error, deprecated?
- reorder plugin menu position
- How can I serve a text file at a custom URL
- How to add custom link to menu in wordpress programmatically?
- Plugin not saving values when placed in a folder within /wp-content/plugins
- Set WordPress TinyMCE Editor To Readonly
- WordPress download manager plugin showing attached file is missing/deleted?
- Display update notification messages like ‘What’s New’
- Gutenberg block can’t save richtext
- Changing page URL and connect newsletter to MailChip
- How to exclude certain files from the plugin editor?
- WordPress and a secondary database?
- How to create an option page for this simple plugin
- How to reorder and display a feed to be chronological?
- Can some vulnerabilities in plugins be exploited even when the plugin is inactive?
- WordPress Plugin Insert Html Code with Shortcode
- How to remove index meta tag
- don’t call ajax if not plugin page
- WordPress gtag.js with User ID tracking
- WP Rest API and json_decode()
- Disable submit button order
- Avada Live is broken on WP
- New Plugin Info request
- Membership and search criteria
- Disable WC Bookings automatic order completion [closed]
- How to make my wordpress site Multi-region
- Migrating site from stage to production server without particular dev. plugins?
- Using “excerpt_more” filter for a specific post type
- w3 total cache and post__not_in
- Shrinktheweb plugin problem
- Backup Buddy Questions
- How do i use postMash to order posts in a custom loop?
- Simple WordPress function / plugin to redirect a site
- How to host a WordPress plugin on my own server and provide updates?
- Sanitizing, Validating , etc (Plugin)
- How to Save Category and Delete Category in same Function
- My site has only one page, and users access my uploaded mp3 files from there – can I analyze access by song title?