| 开发者 | jchristopher |
|---|---|
| 更新时间 | 2022年2月11日 01:09 |
| 捐献地址: | 去捐款 |
| PHP版本: | 3.0 及以上 |
| WordPress版本: | 5.9.0 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
single.php to include the following within The Loop:
`<?php $attachments = new Attachments( 'attachments' ); / pass the instance name / ?>
exist() ) : ?>
Attachments
Total Attachments: total(); ?>
attachments to your ~/wp-content/plugins/ directoryfunctions.php or your own plugin (see Other Notes > Usage)wp-config.php:
define( 'ATTACHMENTS_LEGACY', true ); // force the legacy version of Attachments
Version 3 is a major rewrite. While I've taken precautions in ensuring you won't lose any saved data it is important to back up your database prior to upgrading in case something goes wrong. This version is a complete rewrite so all legacy data will be left in place, but a migration must take place to match the new data storage model and workflow.Please use Attachments UI or see the documentation
Please see Issues on GitHub
attachments_meta_before_saverewind() method to reset Attachments reference array (props joost de keijzer)post_parent argument support for instances, setting to true will populate the Uploaded to column in Mediaattachments_default_instance to disable/enable the default instance (default is true, ATTACHMENTS_DEFAULT_INSTANCE constant is deprecated)attachments_settings_screen to hide/show the settings screen (default is true, ATTACHMENTS_SETTINGS_SCREEN constant is deprecated)post_type had a dash in itattachments_location_{my_instance} (where **{my_instance}** is your instance name) allows for more fine-grained control over where meta boxes show up (e.g. limiting to your Home page)attachments_extension facilitates Attachments extensionswidth( $size ) to retrieve the width of the current Attachmentheight( $size ) to retrieve the height of the current Attachmenttype method from returninglanguages directory wouldn't be utilized for l10nmeta_keyfiletype parameter when searching to limit results in that wayattachments_meta_key facilitates using a different meta key for Attachments storageattachments_get_ **{my_instance}** (where **{my_instance}** is your instance name) allows you to filter Attachments per instance once they've been retrievedappend => false in your instancesearch() method to allow searching for Attachments based on their attributes (e.g. attachment ID, post ID, post type, field values, etc.)int) of the Attachment you'd like to utilize when firing the method.get_single() method that allows you to specifically retrieve a single Attachmenttotal() method that will return the number of Attachments for the current instanceimage() for a non-image Attachment, the WordPress-defined icon will be returnedicon() method that will return the WordPress-defined icon for the Attachment