Forum Replies Created

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • in reply to: CPT with multiple featured images and attached images #4393
    Web Guy
    Member

    Noticing some weird behavior using ‘upload media’ as follows…

    piklist('field', array(
        'type' => 'file'
        ,'field' => 'upload_media'
        ,'scope' => 'post_meta'
        ,'label' => __('Add \'In The News\' Images','products')
        ,'options' => array(
          'modal_title' => __('Add File(s)','products')
          ,'button' => __('Add','products')
        )
      ));

    The images appear and can be managed in the admin, but when I try to display them I can only get five to populate using this code…

    <?php if ( $post->post_type == 'products' && $post->post_status == 'publish' ) {
    	$attachments = get_posts( array(
    		'post_type' => 'attachment',
    		'exclude'     => get_post_meta($post->ID, '_thumbnail_id', false )
    	) );
    
    	if ( $attachments ) {
    		foreach ( $attachments as $attachment ) {
    			$class = "post-attachment mime-" . sanitize_title( $attachment->post_mime_type );
    			$thumbimg = wp_get_attachment_link( $attachment->ID, 'thumbnail-size', true );
    			echo '<li style="display:inline" class="' . $class . ' data-design-thumbnail">' . $thumbimg . '</li>';
    		}
    		
    	}
    }
    ?>

    Also, it seems that I can’t use the Add button in the upload field to attach existing images from the media library. I have to actually upload them. Is this normal?

    in reply to: CPT with multiple featured images and attached images #4373
    Web Guy
    Member

    MY BAD! Attached images already work just like I want them to. Piklist is AMAZING!

    in reply to: CPT with multiple featured images and attached images #4370
    Web Guy
    Member

    So far, so good!

    I can upload multiple Featured Images and attach images to my CPT.

    How can I display the attached images in the admin? I see code for
    displaying them in the fronted, but that won’t work in admin, right?

    In addition to displaying the attached images, any way to delete them
    individually like with Featured Images?

    Featured Images work SO well, attached ones are jealous!

    in reply to: CPT with multiple featured images and attached images #4365
    Web Guy
    Member

    Thanks! I’ll let you know how it works!

    in reply to: CPT with multiple featured images and attached images #4359
    Web Guy
    Member

    Steve

    So I hope you’re saying I can use the same ‘upload field’ code for both
    image attachments, as well as multiple featured images.

    Citing code on:
    https://piklist.com/2013/08/01/v0-8-0-beta-2-and-file-upload-field-with-a-surprise-inside/

    Attaching images…

    piklist(‘field’, array(
    ‘type’ => ‘file’
    ,’field’ => ‘upload_media’
    ,’scope’ => ‘post_meta’
    ,’label’ => ‘Add File(s)’
    ,’options’ => array(
    ‘title’ => ‘Add File(s)’
    ,’button’ => ‘Add’
    )
    ));

    Multiple Featured Images

    piklist(‘field’, array(
    ‘type’ => ‘file’
    ,’field’ => ‘_thumbnail_id’ // changed for thumb
    ,’scope’ => ‘post_meta’
    ,’label’ => ‘Add File(s)’
    ,’options’ => array(
    ‘title’ => ‘Add File(s)’
    ,’button’ => ‘Add’
    )
    ));

    in reply to: CPT with multiple featured images and attached images #4350
    Web Guy
    Member

    In the upload demo, I see this… “Validation rule set: Upload no more than two files.”

    Specifically, I need to upload multiple — more than 2 — “Featured Images” as in…

    https://piklist.com/2013/08/01/v0-8-0-beta-2-and-file-upload-field-with-a-surprise-inside/

    Looks like there was some issues. Are they resolved?

    in reply to: Already have taxonomy, just want checkboxes #3712
    Web Guy
    Member

    Perfect!

    BTW, I recently struggled trying to fine tune the order of meta boxes on a CPT admin page. Is there anything Piklist can do to modify the order of meta boxes?

Viewing 7 posts - 16 through 22 (of 22 total)