Support » Plugin: Attachments » Unable to see Attachments on Custom Post Type

  • Resolved snakespan


    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

    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 – but I get a syntax error on this line:

    $fields => array(

    syntax error on T_DOUBLE_ARROW

    Here is the website in question – (normally the attachments appear on the right of any property page).

    I’ve looked at the documentation but can’t figure it out, so any help would be appreciated.

Viewing 1 replies (of 1 total)
  • Plugin Author Jonathan Christopher


    Where did you add that constant, to wp-config.php? If so, please make sure it’s added to the top of the file, not the bottom.

    The documentation is for version 3+ so please disregard it if using the legacy version. That syntax error was resolved about a week or so ago.

    $fields => array(

    should be

    $fields = array(

Viewing 1 replies (of 1 total)
  • The topic ‘Unable to see Attachments on Custom Post Type’ is closed to new replies.