Skip to content

Instantly share code, notes, and snippets.

@zachskaggs
Created November 20, 2015 21:51
Show Gist options
  • Save zachskaggs/eabbb805f398062b73c1 to your computer and use it in GitHub Desktop.
Save zachskaggs/eabbb805f398062b73c1 to your computer and use it in GitHub Desktop.
<?php
/*
Template Name: Ticket Consignment Standard
*/
get_header(); ?>
<?php if ( have_posts() ) : ?>
<form role="search" method="get" class="searchform" action="<?php echo home_url( '/' ); ?>">
<input type="text" name="s" id="s" value="Search for tickets" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue;" />
<input type="hidden" name="post_type" value="ticket" />
<button type="submit" class="searchsubmit">Submit</button>
</form>
<?php
$args = array(
'post_type'=> 'ticket',
);
$posts = get_posts( $args ); ?>
<h1>Output below is from WordPress Standard functions, NOT ACF functions</h1>
<?php // Start the Loop.
foreach ( $posts as $post ) : setup_postdata( $post );
$contact_name = get_post_meta( get_the_ID() , 'ticket-contact-name' , true );
$contact_phone = get_post_meta( get_the_ID() , 'ticket-contact-phone', true );
$contact_email = get_post_meta( get_the_ID() , 'ticket-contact-email', true );
$event_location = get_post_meta( get_the_ID() , 'ticket-event-location', true );
$event_speaker = get_post_meta( get_the_ID() , 'ticket-event-speaker', true );
$event_date = get_post_meta( get_the_ID() , 'ticket-event-date', true );
?>
<h4><?php the_title(); ?></h4>
<p><strong>Name:</strong> <?php echo $contact_name; ?></p>
<p><strong>Phone:</strong> <?php echo $contact_phone; ?></p>
<p><strong>Email:</strong> <?php echo $contact_email; ?></p>
<p><strong>Location:</strong> <?php echo $event_location; ?></p>
<p><strong>Speaker:</strong> <?php echo $event_speaker; ?></p>
<p><strong>Date:</strong> <?php echo $event_date; ?></p>
<p><strong>Comments:</strong> <?php echo the_content(); ?></p>
<hr>
<?php endforeach; ?>
<?php
// Previous/next page navigation.
wpbase_blog_nav();
else :
// If no content, include the "No posts found" template.
get_template_part( 'content', 'none' );
endif; ?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment