Reputation: 1211
I'm trying to get the attachments plugin for custom post types, but since attachments has updated, I can't get it to show.
define( 'ATTACHMENTS_LEGACY', true ); // force the legacy version of Attachments
I've defined LEGACY to use the old version of attachments (as I know for sure it worked in version 1), but it now only shows for Post and Page types, and not my custom post type of 'Property'.
This is my code in single-property.php
<?php
if( function_exists( 'attachments_get_attachments' ) ){
$attachments = attachments_get_attachments();
$total_attachments = count( $attachments );
if( $total_attachments ) :
for( $i=0; $i<$total_attachments; $i++ ) : ?>
<img src="<?php echo $attachments[$i]['location']; ?>" title="<?php echo $attachments[$i]['title']; ?>" />
<?php endfor; ?>
<?php endif; ?>
<?php } ?>
I've tried creating a custom instance here too - http://wordpress.org/extend/plugins/attachments/other_notes/ but I get a syntax error on this line:
$fields => array(
syntax error on T_DOUBLE_ARROW.
Any help would be much appreciated, as I said it worked before attachments was updated.
Here is the website in question - http://www.james-hayward.com/property/gloucester-road/ (normally the attachments appear on the right of any property page).
Upvotes: 0
Views: 2497
Reputation: 1211
Put
define( 'ATTACHMENTS_LEGACY', true ); // force the legacy version of Attachments
at the top of the config file instead of the bottom and it worked.
Upvotes: 1