List all attachments for a property in property overview?
-
I’m trying to determine how I can list all of the attachments for a specific property in the property overview, rather than the individual property page. We won’t be using the “single” version of the property listing, instead, everything will be in the property overview. I’ve tried
<?php echo do_shortcode('[list_attachments]'); ?>
but it doesn’t work. Any ideas? I would also like to insert the actual attributes in there as well, such as price, size, and other attributes I setup under WP Property > Settings > Developer.I’ve also tried this code, which works to list the attachments on the single page, but when used in the property overview code, just lists ALL attachments for every property in each one, not the ones that belong to just that property.
<?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>'; } ?>
- The topic ‘List all attachments for a property in property overview?’ is closed to new replies.