ID, $fullsize ); $urlp = $blogg."/wp-content/plugins/auto-attachments"; $sAttachmentString = "
\n"; 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 ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "$file_name[0]"; $sAttachmentString .= "
"; } } //Word Documents 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/msword', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "$file_name[0]"; $sAttachmentString .= "
"; } } //Powerpoint Documents 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/vnd.ms-powerpoint', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "$file_name[0]"; $sAttachmentString .= "
"; } } //Excel Documents 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/vnd.ms-excel', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "$file_name[0]"; $sAttachmentString .= "
"; } } //Zipped Files 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/zip', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "$file_name[0]"; $sAttachmentString .= "
"; } } //Rar files 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/x-rar-compressed', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "$file_name[0]"; $sAttachmentString .= "
"; } } //x-tar files 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/x-tar', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "$file_name[0]"; $sAttachmentString .= "
"; } } //x-gzip files 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/x-gzip', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "$file_name[0]"; $sAttachmentString .= "
"; } } //ODS 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/vnd.oasis.opendocument.spreadsheet', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "$file_name[0]"; $sAttachmentString .= "
"; } } //ODF 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/vnd.oasis.opendocument.formula', //MIME Type condition ))){ foreach( $files as $file ){ //setup array for more than one file attachment $file_link = wp_get_attachment_url($file->ID); //get the url for linkage $file_name_array=explode("/",$file_link); $file_name=array_reverse($file_name_array); //creates an array out of the url and grabs the filename $sAttachmentString .= "
"; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= ""; $sAttachmentString .= "
"; $sAttachmentString .= "$file_name[0]"; $sAttachmentString .= "
"; } } //Audio Files $mp3s = 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' => 'audio', //MIME Type condition ) ); if (!empty($mp3s)) : $blogg = get_bloginfo('url'); $urlp = $blogg."/wp-content/plugins/auto-attachments"; $sAttachmentString .= "
"; endif; //Video Support flv, mp4, etc. added with 0.2 $videoss = 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' => 'video', //MIME Type condition ) ); if (!empty($videoss)) : $blogg = get_bloginfo('url'); $urlp = $blogg."/wp-content/plugins/auto-attachments"; $sAttachmentString .= "
"; endif; $sAttachmentString .= "
"; $sAttachmentString .= "
"; if($echo){ echo $sAttachmentString; } return $sAttachmentString; } //Insert code after the_content add_filter('the_content', insertintoContent); function insertintoContent($content) { if(is_single()) { $content .= get_attachment_icons(); } return $content; } //Add Css into Header add_action('wp_head', addHeaderCode); function addHeaderCode() { $blogg = get_bloginfo('url'); $urlp = $blogg."/wp-content/plugins/auto-attachments"; echo '' . "\n"; }; //Add RAR upload allow function yeni_mime_type($mimes) { $yeni_mime = array ( 'rar' => 'application/x-rar-compressed'); return array_merge($mimes,$yeni_mime); } add_filter('upload_mimes','yeni_mime_type'); ?>