Skip to content

Instantly share code, notes, and snippets.

@randombell
Created May 16, 2012 21:27
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 randombell/2714080 to your computer and use it in GitHub Desktop.
Save randombell/2714080 to your computer and use it in GitHub Desktop.
<?php
/**
* Template Name: VTN Members Page Template
*/
get_header(); ?>
<!-- begin colLeft -->
<!--<div id="colLeft">-->
<h1><?php the_title(); ?></h1>
<!-- LOOP THE CONTENT ALPHABETICALLY -->
<?php
$loop = new WP_Query(array(
'post_type' => 'vtnmember',
'orderby' => 'name',
'order' => 'ASC', ));
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php
// instead of using helper functions, you can also use ...
$meta = get_post_meta(get_the_ID(), $full_mb->get_the_id(), TRUE);
// or ... (same as above)
// $meta = $custom_metabox->the_meta();
echo '<div id="member"><div id="logo">', the_post_thumbnail(), '</div>';
echo '<div id="member_info">';
if($meta['name']!="")
{
echo '<b>', $meta['name'], '</b>';
}
else
{
echo ' ';
}
if($meta['name_sec']!="")
{
echo '<div class="name_sec">', $meta['name_sec'], '</div>';
}
else
{
echo ' ';
}
echo '<div class="vtn_address">',
$meta['address'],
',&nbsp;',
$meta['city'],
'<br>',
'Ph:&nbsp;', $meta['phone'];
if($meta['fax']!="") // Two times Doule Quotation marks that is, and != means "not equal to". So we mean to say if $code is not equal to empty
{
echo '&nbsp;&bull;&nbsp;Fax:&nbsp;', $meta['fax'];
}
else
{
echo ' ';
}
'</div>';
if($meta['website']!="")
{
echo '<div class="vtn_website"><a href="'.$website.'" target="_blank">'.$website.'</a></div>';
}
else
{
echo ' ';
}
if($meta['cores']!="")
{
echo '<p><u>Core Competencies:</u>&nbsp;', $meta['cores'], '</p></div>';
}
else
{
echo ' ';
}
?>
<?php the_content(); ?>
</div>
</div>
<?php endwhile; ?> <!--</div>-->
<!-- end colleft -->
<?php get_footer(); ?>
<div class="my_meta_control">
<p>Enter any or all content for the company that you have. If the box is empty, no content will display on the main page.</p>
<p><label>Company Name</label>
<input type="text" name="<?php $metabox->the_name('name'); ?>" value="<?php $metabox->the_value('name'); ?>"/></p>
<?php while($metabox->have_fields_and_multi('docs')): ?>
<?php $metabox->the_group_open(); ?>
<p><label>Secondary Company Name</label>
<input type="text" name="<?php $metabox->the_name('name_sec'); ?>" value="<?php $metabox->the_value('name_sec'); ?>"/></p>
<p><label>Street Address</label>
<input type="text" name="<?php $metabox->the_name('address'); ?>" value="<?php $metabox->the_value('address'); ?>"/></p>
<p><label>City, State, Zip Code</label>
<input type="text" name="<?php $metabox->the_name('city'); ?>" value="<?php $metabox->the_value('city'); ?>"/></p>
<p><label>Phone Number</label>
<input type="text" name="<?php $metabox->the_name('phone'); ?>" value="<?php $metabox->the_value('phone'); ?>"/></p>
<p><label>Fax Number</label>
<input type="text" name="<?php $metabox->the_name('fax'); ?>" value="<?php $metabox->the_value('fax'); ?>"/></p>
<p><label>Website</label>
<input type="text" name="<?php $metabox->the_name('website'); ?>" value="<?php $metabox->the_value('website'); ?>"/>
<span>DO NOT INCLUDE the "http://" in the web address. It will break. I warned you.</span></p>
<p><label>Core Competencies</label>
<?php $metabox->the_field('cores'); ?>
<textarea name="<?php $metabox->the_name(); ?>" rows="3"><?php $metabox->the_value(); ?></textarea></p>
<a style="float:right; margin:0 10px;" href="#" class="dodelete-docs button">Remove All</a>
<a href="#" class="dodelete button">Remove Location</a></p>
<span style="padding:25px 0;"><hr /></span>
<?php $metabox->the_group_close(); ?>
<?php endwhile; ?>
<p style="margin-bottom:15px; padding-top:5px;"><a href="#" class="docopy-docs button">Add Location</a></p>
</div>
<?php
$full_mb = new WPAlchemy_MetaBox(array
(
'id' => '_full_mb',
'title' => 'VTN Members',
'types' => array('vtnmember'), // added only for pages and to custom post type "events"
'context' => 'normal', // same as above, defaults to "normal"
'priority' => 'high', // same as above, defaults to "high"
'template' => get_stylesheet_directory() . '/metaboxes/vtn-meta.php'
));
/* eof */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment