Hallo zusammen ...
Ich hab was nettes gefunden - ein Script das Icons + Urls von Dateiuploads unter dem Artikel ausgibt
look: http://www.gaugeinteractive.com/mime-type-example/
Allesdings hätte ich das lieber so, dass einfach vor meinem Link im Text ein Icon erscheint ... ich weiss nur nicht wie das umstellen muss damit es geht ...
hier der quelltext
PHP
<?php query_posts('p=1068');?> //Wordpress Query, just grabbing one post
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> //initialize Wordpress loop
<?php the_title();?>
<?php the_content();?>
<?php if ( $files = get_children(array( //do only if there are attachments of these qualifications
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => -1,
'post_mime_type' => 'application/pdf', //MIME Type condition
))) : ?>
<?php foreach( $files as $file ) : ?> //setup array for more than one file attachment
<?php $file_link = wp_get_attachment_url($file->ID); ?> //get the url for linkage
<?php $file_name_array=explode("/",$file_link); ?> <?php $file_name=array_reverse($file_name_array); ?> //creates an array out of the url and grabs the filename
<div>
<a href="<?php echo $file_link;?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/mime/pdf.jpg" alt="PDF" /></a>
<a href="<?php echo $file_link;?>"><?php echo $file_name[0];?></a>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php if ( $files = get_children(array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => -1,
'post_mime_type' => 'application/msword',
))) : ?>
<?php foreach( $files as $file ) : ?>
<?php $file_link = wp_get_attachment_url($file->ID); ?>
<?php $file_name_array=explode("/",$file_link); ?> <?php $file_name=array_reverse($file_name_array); ?>
<div>
<a href="<?php echo $file_link;?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/mime/doc.jpg" alt="Word Document" /></a>
<a href="<?php echo $file_link;?>"><?php echo $file_name[0];?></a>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php if ( $files = get_children(array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => -1,
'post_mime_type' => 'application/zip',
))) : ?>
<?php foreach( $files as $file ) : ?>
<?php $file_link = wp_get_attachment_url($file->ID); ?>
<?php $file_name_array=explode("/",$file_link); ?> <?php $file_name=array_reverse($file_name_array); ?>
<div>
<a href="<?php echo $file_link;?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/mime/zip.jpg" alt="Zip File" /></a>
<a href="<?php echo $file_link;?>"><?php echo $file_name[0];?></a>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php if ( $files = get_children(array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => -1,
'post_mime_type' => 'audio/mpeg',
))) : ?>
<?php foreach( $files as $file ) : ?>
<?php $file_link = wp_get_attachment_url($file->ID); ?>
<?php $file_name_array=explode("/",$file_link); ?> <?php $file_name=array_reverse($file_name_array); ?>
<div>
<a href="<?php echo $file_link;?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/mime/mp3.jpg" alt="MP3 File" /></a>
<a href="<?php echo $file_link;?>"><?php echo $file_name[0];?></a>
</div>
<?php endforeach; ?>
<?php endif; ?>
<?php endwhile; endif;?>
Alles anzeigen
wahlweise der link zur scriptwebsite: http://www.gaugeinteractive.com/web-related/wo…ropriate-icons/
kennt jemand eine Lösung? ... DANKE!
gruß
mag