Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Tạo một mẫu phương tiện truyền thông Mặc dù hình ảnh trực tuyến và các phương tiện khác có thể là tuyệt vời trong một số trường hợp, đôi khi bạn thực sự muốn có thể để làm nổi bật tầm quan trọng của tập tin đính kèm bằng cách đặt các mục trên trang riêng của mình và liên kết với nó. | Chapter 8 results in the following HTML div class wp-caption alignnone style width 310px img src http wp.local wp-content uploads 2009 10 Tulips2-300x225. jpg alt Test Caption title Tulips width 300 height 225 class size-medium wp-image-105 p class wp-caption-text Test Caption p div Here the pertinent classes to style are wp-caption wp-caption-text Both of them are styled in this recipe s instructions. See also Aligning images properly within a post Creating a media template Although in-line images and other media can be great in some circumstances sometimes you really want to be able to highlight the importance of an attachment by placing the item on its own page and linking to it. Luckily WordPress has support for attachment templates allowing you to emphasize attachments appropriately. Getting started The only requirement for this recipe is that you are working on a modern WordPress theme that works with WordPress 2.8 or 2.9. How to do it. First we need to create the attachment template. The basic attachment template that we are going to create must be called attachment.php. This template will be used to serve all attachment links. Open attachment.php and insert the following template code html head title php the_title title head body 165 Integrating Media------------------------------------------------------------ php meta wp_get_attachment_metadata post- ID size medium div style margin 0 auto width php echo meta sizes size width 20 text-align left padding 10px border 5px solid 000 php echo wp_get_attachment_link post- ID size div body html Save the file and upload it to your current theme folder. You can see what the uploaded image would look like by viewing the screenshot below How it works. The above example effectively highlights the attachment image by surrounding it with a simple bordered div and aligning it to the left within the browser window. Here the medium version of the image is used and the full version is linked to directly so that users can .