Okay, I figured out how to output the actual attributes of the property into the property overview, for my own and others future reference, you use @draw_stats. For example:
<?php
if($property['property_type']=='site') { // Output stats for Sites
echo @draw_stats('display=list&class=testing&exclude=port,rail,salelease,phone_number,type_property&sort_by_groups=false', $property );
}
else { // Output stats for Buildings
echo @draw_stats('display=list&exclude=phone_number&sort_by_groups=false', $property );
}
?>
In draw_stats, you can “exclude” or “include” which property stat you want to output by using a comma-separated list.
I still can’t figure out how to output the attachments for each property in the property overview listings, though. Has anyone had success with this? I know it’s not probably a frequent request.
Thanks.
If I use this code:
<?php
// Property Attachments - PDFs, Word Docs, etc.
$args = array(
'post_type' => 'attachment',
'post_mime_type' => 'application/pdf,application/msword',
'numberposts' => -1,
'post_status' => null,
/* 'post_parent' => $post->ID, */
'orderby' => 'menu_order',
'order' => 'desc'
);
$attachments = get_posts($args);
if ($attachments) {
echo '<div class="property_docs"><h3>Property Documents</h3><ul>';
foreach ($attachments as $attachment) {
echo '<li><a href="'.wp_get_attachment_url($attachment->ID).'" target="_blank">';
echo $attachment->post_title;
echo '</a></li>';
}
echo '</ul></div>';
}
?>
It will list all attachments for ALL properties in each property over listing, which is close to what I want… except I just want each listing to only list its own attachments… So it seems to me that post_parent is the thing I may be missing? What the proper value is for this field. Hmmm…
I figured it out.
Instead of using property-overview.php’s loop, try using property-overview-plain_list.php.
if($properties): ?>
<ul class="<?php wpp_css('property_overview_plain_list::row_view', "wpp_row_view"); ?>">
<?php foreach($properties as $property_id): ?>
<?php $property = prepare_property_for_display(get_property($property_id, ($show_children ? "get_property['children']={$show_property['children']}" : ""))); ?>
<li class="<?php wpp_css('property_overview_plain_list::property_div', "property_div"); ?>">
<a href="<?php echo $property['permalink']; ?>"><?php echo $property['post_title']; ?></a>
<?php if($show_children && $property['children']): ?>
<ul class="child_properties">
<?php foreach($property['children'] as $child): ?>
<li><a <?php echo $in_new_window; ?> href="<?php echo $child['permalink']; ?>"><?php echo $child['post_title']; ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul><?php // .wpp_property_list ?>
<?php endif; ?>
Then, use the regular attachment code, and it should work – with $property_id as the post_parent. This code will show all attached PDFs and Word docs inside each listing on your property-overview. 🙂
<?php
// Property Attachments - PDFs, Word Docs, etc.
$args = array(
'post_type' => 'attachment',
'post_mime_type' => 'application/pdf,application/msword',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $property_id,
'orderby' => 'menu_order',
'order' => 'desc'
);
$attachments = get_posts($args);
if ($attachments) {
echo '<div class="property_docs"><h3>Property Documents</h3><ul>';
foreach ($attachments as $attachment) {
echo '<li><a href="'.wp_get_attachment_url($attachment->ID).'" target="_blank">';
echo $attachment->post_title;
echo '</a></li>';
}
echo '</ul></div>';
}
?>