Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save joedooley/1fa23535702620e466a6 to your computer and use it in GitHub Desktop.
Save joedooley/1fa23535702620e466a6 to your computer and use it in GitHub Desktop.
Example template using a model representing the post.
<?php
$contact = AWP_CTP_Model_Contact::get_instance( get_the_ID() );
?>
<article id="post-<?php echo $contact->get_ID(); ?>">
<?php if ( $contact->get_featured_image_url() ) : ?>
<div class="ecc-contact-image">
<img class="th" src="<?php echo $contact->get_featured_image_url(); ?>" alt="<?php echo $contact->get_display_title(); ?>" title="<?php echo $contact->get_display_title(); ?>" />
</div>
<?php endif; ?>
<header class="entry-header" >
<h1><?php echo $contact->get_display_title(); ?></h1>
</header>
<div class="entry-content">
<?php echo $contact->get_the_content(); ?>
<h3>Sample Repeater</h3>
<table>
<?php foreach ( $contact->get_repeater_samples() as $repeater_sample ): ?>
<tr>
<td><?php echo $repeater_sample->get_field_one(); ?></td>
<td><?php echo $repeater_sample->get_field_two(); ?></td>
</tr>
<?php endforeach; ?>
</table>
<?php $phone = $contact->get_phone_primary(); ?>
<?php $email = $contact->get_email_primary(); ?>
<?php $location = $contact->get_office_location(); ?>
<h4><?php printf( __( 'Contact %s', 'yourplugin-text-domain' ), $contact->get_first_name() ); ?></h4>
<ul class="no-bullet">
<?php if ( !empty( $phone ) ) : ?>
<li><strong>Office Phone: </strong><br /><a href="tel:<?php echo $render_phone; ?>"><?php echo $render_phone; ?></a></li>
<?php endif; ?>
<?php if ( !empty( $email ) ) : ?>
<li><strong>Email: </strong><br /><a href="mailto:<?php echo $contact->get_email_primary(); ?>"><?php echo $contact->get_email_primary(); ?></a></li>
<?php endif; ?>
<?php if ( !empty( $location ) ) : ?>
<li><strong>Office Location: </strong> <br /><?php echo $contact->get_office_location(); ?></li>
<?php endif; ?>
</ul>
<p>
<strong>Address</strong>
<?php echo $contact->get_address_one(); ?><br />
<?php echo $contact->get_address_city(); ?>, <?php echo $contact->get_address_region(); ?><br />
<?php echo $contact->get_address_postal_code(); ?>
</p>
</div>
</article>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment