Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of the use the the PDb_Template class for a Participants Database single record shortcode
* 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') ?>
<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') ?>
<?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') ?>
<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')); ?>
<?php // show the "More Details" data as a loop
echo do_shortcode('[[pdb_single template=loop groups=more_details]]'); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment