Skip to content

Instantly share code, notes, and snippets.

@xnau
Created December 4, 2018 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xnau/1a85b839f71b965ca73dbcca57f71adf to your computer and use it in GitHub Desktop.
Save xnau/1a85b839f71b965ca73dbcca57f71adf to your computer and use it in GitHub Desktop.
Example of the use the the PDb_Template class for a Participants Database single record shortcode
<?php
/*
* template for displaying a business detailed view
*
* single record template
*/
// get the template object for this record
$this_business = new PDb_Template($this);
?>
<h1 class="business-title"
<?php $this_business->print_field('business_name') ?>
</h1>
<div class="wrap <?php echo $this->wrap_class ?>">
<?php if ($this_business->has_content('photo')) : ?>
<div class="business-photo">
<?php $this_business->print_field('photo') ?>
</div>
<?php endif ?>
<div class="business-info one-half">
<h3 class="business-address">
<?php $this_business->print_field('address') ?><br />
<?php $this_business->print_field('city') ?>, <?php $this_business->print_field('state') ?><br />
<?php $this_business->print_field('phone') ?><br />
<?php $this_business->print_field('website') ?>
</h3>
<p class="business-details">
<strong>Category: </strong><?php $this_business->print_field('type_of_business') ?><br />
<strong>Neighborhood: </strong><?php $this_business->print_field('neighborhood') ?><br />
<strong>Years in Business: </strong><?php echo date('Y') - date('Y', $this_business->get_value('year_established')); ?>
</p>
</div>
<?php // show the "More Details" data as a loop
echo do_shortcode('[[pdb_single template=loop groups=more_details]]'); ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment