Home › Forums › Ticket Products › Event Tickets Plus › show product not tickets
- This topic has 6 replies, 3 voices, and was last updated 7 years, 6 months ago by Riccardo.
-
AuthorPosts
-
November 14, 2016 at 2:12 pm #1192094RiccardoParticipant
Hi,
I want display some product there aren’t ticket.
so what is the right query?
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => 50,
);
$loop = new WP_Query( $args );
if ( $loop->have_posts() ) {
while ( $loop->have_posts() ) : $loop->the_post(); ?>" title="<?php the_title(); ?>">
<?php the_title(); ?>
<?php
endwhile;
} else {
echo __( 'No products found' );
}
wp_reset_postdata();
?>If I use this it show all the products.
thanksNovember 15, 2016 at 7:34 am #1192417AndrasKeymasterHello Riccardo,
Thanks for using our plugins and for reaching out!
We are limited in supporting customization but I can try to point you in the right direction.
Yes, the query above will show all the tickets as well, as they are also products.
You could try to do the following:
Filter out (and now show) those products where in the wp_postmeta table the meta_key _visibility is hidden and meta_key _virtual is yes. These are the attributes that the tickets have.
Or another way would be, if the product has a meta_key named _tribe_wooticket_for_event, then it is a ticket, so don’t show it.
I hope this helps you get started. Let me know.
Cheers,
AndrasNovember 15, 2016 at 10:18 am #1192619RiccardoParticipantHi Andras,
this is how I try.'posts_per_page' => 50, 'post_status' => 'publish', 'post_type' => 'product', // 'meta_key' => '_tribe_wooticket_for_event', // PETTE escludo tutti gli articoli che non hanno meta_key _tribe_wooticket_for_event' 'meta_query' => array( array( 'key'=>'_tribe_wooticket_for_event', 'compare' => 'NOT EXISTS' ) ), );
Is it another right way?
ThanksNovember 16, 2016 at 7:21 am #1193125AndrasKeymasterCiao Riccardo,
Yeah, I believe this should be fine. Let me know how it works out.
Cheers,
AndrasNovember 16, 2016 at 7:59 am #1193140RiccardoParticipantThanks!
November 17, 2016 at 2:33 pm #1194158AndrasKeymasterNo problemo! Happy it helped.
Since this is marked resolved I am going to close this ticket, but if you need anything else related to this topic or another please post a new topic in the forum and we will help you out.
Cheers,
AndrasPS: If you like our plugin, and you didn’t yet do so 🙂 we would be happy to receive a review in the wordpress.org repository. Thanks!
https://wordpress.org/support/view/plugin-reviews/the-events-calendarPS2: We’d be also grateful if you would give us feedback on your satisfaction with support. Just click on one of the classy looking emojis below. 🙂 If you can spare a few words, that’s even better. Doublethanks!
-
AuthorPosts
- The topic ‘show product not tickets’ is closed to new replies.