Exemple #1
0
        $urls = [get_attachment_link($attachment->ID), get_attached_file($attachment->ID)];
        echo '<table>';
        echo '<tr>';
        ?>
<!--a href='<?php 
        echo get_attachment_link($attachment->ID);
        ?>
-->
<a href='<?php 
        echo get_attached_file($attachment->ID);
        ?>
'>
<?php 
        echo $attachment->post_title;
        ?>
</a>
<?php 
        foreach ($urls as $url) {
            echo '<td>';
            echo $url;
            echo '</td>';
        }
        echo '</tr>';
        echo '</table>';
    }
}
show_attachment_file_list('alfonso');
?>
</body>
</html>
Exemple #2
0
echo $post->post_title.'<br/>';
echo $post->post_content;

function show_attachment_file_list( $cat )
{
	$args = [
		'post_type' => 'attachment',
		'numberposts' => -1,
		'post_status' => null,
		'category_name' => $cat
	];
	$attachments = get_posts( $args );
	foreach( $attachments as $attachment ):
		echo '<ul>';
?>
<a href='<?php echo get_attachment_link( $attachment->ID ); ?>'>
<?php echo $attachment->post_title ?>
<?php echo get_attached_file( $attachment->ID ); ?>
</a>
<?php
		echo '</ul>';
endforeach;
}

show_attachment_file_list( 'pentecost' );
// show_attachment_file_list( 'alfonso' );

?>
</body>
</html>