Support

Account

Home Forums General Issues File Upload – Skip Media Library Reply To: File Upload – Skip Media Library

  • <div id="scanned-mail">
    
        <div class="grid-x grid-margin-x files">  
            
            <?php if ( $post->post_type == 'company' && $post->post_status == 'publish' ) {
            $attachments = get_posts( array(
                'post_type' => 'attachment',
                'posts_per_page' => -1,
                'post_parent' => $post->ID,
                'exclude'     => get_post_thumbnail_id()
            ) );
    
                if ( $attachments ) {
                    foreach ( $attachments as $attachment ) { ?>
    
                    <div class="cell medium-12 large-12 file b6">
                        
                        <?php $fileurl = wp_get_attachment_url( $attachment->ID ); $filename = get_the_title( $attachment->ID ); ?>
                        
                        <div class="file-type">
    
                            <i class="fa-solid fa-file-pdf"></i>
    
                        </div>
                        
                        <div class="file-name">
                            
                            <span><?php echo $filename; ?></span>
    
                        </div>
                        
                        <div class="file-size">                        
                                        
                            <span><?php $attachment_filesize = size_format( filesize( get_attached_file( $attachment->ID ) ), 2 ); echo $attachment_filesize; ?></span>
                            
                        </div>
                        
                        <div class="file-upload-date">
                            
                            <span><?php echo date('F d, Y H:i:s', strtotime($attachment->post_date)); ?></span>
                            
                        </div>
                        
                        <div class="file-expiry-date">
                            
                            <span><?php echo date('F d, Y H:i:s', strtotime($attachment->post_date. ' + 180 days')); ?></span>
                            
                           
                            
                        </div>
                        
                        <div class="file-actions">
                            
                            <ul>
                                
                                <li>
    
                                    <a href="<?php echo do_shortcode('[pda_private_link file_id="' . attachment_url_to_postid( $fileurl ) . '"]'); ?>" target="_blank"><i class="fa-duotone fa-eye"></i></a>
    
                                </li>
    
                                <li>
    
                                    <a href="<?php echo do_shortcode('[pda_private_link file_id="' . attachment_url_to_postid( $fileurl ) . '"]'); ?>" download><i class="fa-duotone fa-download"></i></a>
    
                                </li>
                            
                            </ul>
                            
                        </div>
                        
                    </div>
    
                    <?php }
    
                }
            }
            ?>
    
        </div>
        
    </div>