public
Created

  • Download Gist
page-vtnmember.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
<?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(); ?>
vtn-meta.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
<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>
vtn-spec.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13
<?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 */

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.