Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Giannisduke/02d88eda2e8cbd6b4ebeb7a44148cc9c to your computer and use it in GitHub Desktop.
Save Giannisduke/02d88eda2e8cbd6b4ebeb7a44148cc9c to your computer and use it in GitHub Desktop.
WooCommerce Bookings template for displaying Persons and it's meta info of a booking product
<?php
/*
Template Name: Bookings Person types list
*/
?>
<?php get_header(); ?>
<?php
//Define your custom post type name in the arguments
$args = array('post_type' => 'bookable_person');
//Define the loop based on arguments
$loop = new WP_Query( $args );
//Display the contents
while ( $loop->have_posts() ) : $loop->the_post();
?>
<h1 class="entry-title"><?php the_title(); ?></h1>
<div class="entry-content">
<?php the_content(); ?>
<?php the_meta(); ?>
<h3>Person Cost only</h3>
<p>Additional cost per <?php the_title(); ?> is: <?php echo get_post_meta( get_the_ID(), 'cost', true );?></p>
</div>
<?php endwhile;?>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment