| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | Plugin Name: WP Attachments |
| 4 | 4 | Plugin URI: http://marcomilesi.ml |
| 5 | 5 | Description: Automatically shows your attachments under every post and page content. Simple. Automatic. Easy. As it has to be! |
| 6 | 6 | Author: Marco Milesi |
| 7 | -Version: 3.2.4 | |
| 7 | +Version: 3.2 | |
| 8 | 8 | Author URI: http://marcomilesi.ml |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | function wpa_action_init() |
| @@ -10,10 +10,9 @@ | ||
| 10 | 10 | |
| 11 | 11 | function wpa_action_init() |
| 12 | 12 | { |
| 13 | 13 | load_plugin_textdomain( 'wp-attachments', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
| 14 | - update_option( 'wpa_version_number', '3.2.4' ); | |
| 15 | - wp_enqueue_style('wpa-css', plugin_dir_url(__FILE__) . 'styles/frontend.css'); | |
| 14 | + update_option( 'wpa_version_number', '3.2' ); | |
| 16 | 15 | } |
| 17 | 16 | |
| 18 | 17 | // Add actions |
| 19 | 18 | add_action('init', 'wpa_action_init'); |
| @@ -25,9 +24,9 @@ | ||
| 25 | 24 | |
| 26 | 25 | if ($a_bytes < 1024) |
| 27 | 26 | { |
| 28 | 27 | |
| 29 | - return '< 1KB'; | |
| 28 | + return $a_bytes . ' B'; | |
| 30 | 29 | |
| 31 | 30 | } |
| 32 | 31 | elseif ($a_bytes < 1048576) |
| 33 | 32 | { |
| @@ -63,10 +62,8 @@ | ||
| 63 | 62 | { |
| 64 | 63 | global $post; |
| 65 | 64 | $somethingtoshow = 0; |
| 66 | 65 | |
| 67 | - if ($post->ID == '0' || $post->ID == NULL) { return $content; } //Skip the attachments list if POST ID is null | |
| 68 | - | |
| 69 | 66 | $attachments = get_posts(array( |
| 70 | 67 | 'post_type' => 'attachment', |
| 71 | 68 | 'orderby' => 'menu_order', |
| 72 | 69 | 'order' => 'ASC', |
| @@ -76,9 +73,18 @@ | ||
| 76 | 73 | |
| 77 | 74 | if ($attachments) |
| 78 | 75 | { |
| 79 | 76 | $content_l .= '<div style="width:100%;float:left;margin:10px 0 10px 0;"><h3>' . get_option('wpatt_option_localization') . '</h3> |
| 80 | - <ul class="post-attachments">'; | |
| 77 | + <style> | |
| 78 | + ul.post-attachments{list-style:none;margin:0;} | |
| 79 | + li.post-attachment{background:url(' . plugin_dir_url(__FILE__) . 'icons/document.png) 0 4px no-repeat;padding-left:24px} .post-attachment.mime-imagejpeg,.post-attachment.mime-imagepng,.post-attachment.mime-imagejpeg,.post-attachment.mime-imagegif{background-image:url(' . plugin_dir_url(__FILE__) . 'icons/document-image.png)} | |
| 80 | + .post-attachment.mime-applicationzip{background-image:url(' . plugin_dir_url(__FILE__) . 'icons/document-zipper.png)} | |
| 81 | + .post-attachment.mime-applicationpdf{background-image:url(' . plugin_dir_url(__FILE__) . 'icons/document-pdf.png)} | |
| 82 | + .post-attachment.mime-applicationvnd-ms-excel{background-image:url(' . plugin_dir_url(__FILE__) . 'icons/document-excel.png)} | |
| 83 | + .post-attachment.mime-applicationvnd-openxmlformats-officedocument-spreadsheetml-sheet{background-image:url(' . plugin_dir_url(__FILE__) . 'icons/document-excel.png)} | |
| 84 | + .post-attachment.mime-applicationmsword{background-image:url(' . plugin_dir_url(__FILE__) . 'icons/document-word.png)} | |
| 85 | + .post-attachment.mime-applicationvnd-openxmlformats-officedocument-wordprocessingml-document{background-image:url(' . plugin_dir_url(__FILE__) . 'icons/document-word.png)} | |
| 86 | + </style><ul class="post-attachments">'; | |
| 81 | 87 | |
| 82 | 88 | foreach ($attachments as $attachment) |
| 83 | 89 | { |
| 84 | 90 | |