diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..abb4284 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,31 @@ +# Changelog for Attachment Slugs for WordPress + +## v2.0.0 - 13th December 2022 + +### What's New? + +* Just a little refresh of the plugin to keep it up to date with the latest WordPress. + +> This update improves the permalinks and corrects a few mistakes. You will have to redo your attachment permalinks once updated to this version of the plugin. + +## v1.0.1 - 16th February 2019 + +* New: Ready for WordPress 5.1 release. 🎊 + +## v1.0.0 - 3rd December 2018 + +* New: Attachments can edit their own permalink slug. 🎉 +* Checked: Compatibility with WordPress 5.0 +* Improved: The main file has been re-written. + +> Now requires WordPress version 4.4.0 or higher. + +## v0.0.2 - 16th November 2017 + +* FIXED: Attachment base option when saving the permalinks. +* FIXED: Undefined variable in permalink-settings.php +* RENAMED: Plugin name for better SEO results. + +## v0.0.1 - 27th February 2016 + +* Initial Version. diff --git a/README.md b/README.md index e9dc65d..3e346f2 100644 --- a/README.md +++ b/README.md @@ -6,54 +6,49 @@ [![WordPress Plugin Rating](https://img.shields.io/wordpress/plugin/r/attachment-slug.svg?style=flat-square)](https://wordpress.org/support/view/plugin-reviews/attachment-slug?filter=5) [![WordPress Plugin Downloads](https://img.shields.io/wordpress/plugin/dt/attachment-slug.svg?style=flat)](https://wordpress.org/plugins/attachment-slug/) -**Contributors:** sebd86 -**Donate link:** https://sebdumont.xyz/donate/ -**Tags:** attachment, attachments, attachment slug, page slug, image slug, image url, permalinks, custom permalinks -**Requires PHP:** 5.6 -**Requires at least:** 4.4 -**Tested up to:** 5.1 -**Stable tag:** 1.0.1 -**License:** GPL v2 or later - -###### Follow me +##### Follow me 💻 [Website](https://sebastiendumont.com) 🐦[Twitter](https://twitter.com/sebd86) ## 🔔 Overview -Enables WordPress to allow attachments to have their own permalink structure. This makes the URLs more friendly and great for SEO results should you decide to index your attachments. +**Attachment Slugs for WordPress** enables you to add permalink support for media attachments making the attachment URLs more friendly and great for SEO results should you decide to index your attachments. -You can also edit the permalink slug of an indvidual attachment which you can not do via _Quick Edit_ like other post types. Changing the attachment title does not update the permalink slug so this handy to have should you want to rename the URL for the attachment. +You can also edit the permalink slug of an individual attachment which you can not do via _Quick Edit_ like other post types. Changing the attachment title does not update the permalink slug so this handy to have should you want to rename the URL for the attachment. +## How to edit an attachment slug? -#### ✅ Requirements +Simply go to the media library and edit the item you wish to rename. Then on the left side under "Attachment Slug" you can rename the slug. Press the "Update" button and that's it. + +### ✅ Requirements To use this plugin you will need: * PHP v5.6 * WordPress v4.4 minimum -#### 💽 Installation +### 💽 Installation -###### Manual +#### Manual 1. Download a `.zip` file with the [latest version](https://github.com/seb86/attachment-slugs/releases). 2. Go to **WordPress Admin > Plugins > Add New**. 3. Click **Upload Plugin** at the top. 4. **Choose File** and select the `.zip` file you downloaded in **Step 1**. 5. Click **Install Now** and **Activate** the plugin. -###### Automatic +#### Automatic 1. Go to **WordPress Admin > Plugins > Add New**. 2. Search for **Attachment Slugs** 3. Click **Install Now** on the plugin and **Activate** the plugin. -#### Screenshots +### Screenshots + ![Permalink Options for Attachments](https://raw.githubusercontent.com/seb86/attachment-slugs/master/.wordpress-org/assets/screenshot-1.png) ![Edit Attachment Slug](https://raw.githubusercontent.com/seb86/attachment-slugs/master/.wordpress-org/assets/screenshot-2.png) -#### 📝 Reporting Issues +### 📝 Reporting Issues If you think you have found a bug in the extension, please [open a new issue](https://github.com/seb86/attachment-slugs/issues/new) and I will do my best to help you out. @@ -67,21 +62,15 @@ You'll be helping to ensure I can spend the time not just fixing bugs, but keepi Please also consider starring ✨ and sharing 👍 the project repo! This helps the project getting known and grow with the community. 🙏 I accept one-time donations and monthly via [BuyMeACoffee.com](https://www.buymeacoffee.com/sebastien) -- [My PayPal](https://www.paypal.me/codebreaker) -- [BuyMeACoffee.com](https://www.buymeacoffee.com/sebastien) -- Bitcoin (BTC): `3L4cU7VJsXBFckstfJdP2moaNhTHzVDkKQ` -- Ethereum (ETH): `0xc6a3C18cf11f5307bFa11F8BCBD51F355b6431cB` -- Litecoin (LTC): `MNNy3xBK8sM8t1YUA2iAwdi9wRvZp9yRoi` Thank you for your support! 🙌 - -##### License +#### License Attachment Slugs for WordPress is released under [GNU General Public License v3.0](http://www.gnu.org/licenses/gpl-3.0.html). -##### Credits +#### Credits Attachment Slugs for WordPress is developed and maintained by [Sébastien Dumont](https://sebastiendumont.com/about/). diff --git a/admin/class-as-permalink-settings.php b/admin/class-as-permalink-settings.php index b5993f8..2fa3bd9 100644 --- a/admin/class-as-permalink-settings.php +++ b/admin/class-as-permalink-settings.php @@ -4,9 +4,9 @@ * * @author Sébastien Dumont * @category Admin - * @package Attachment Slug/Admin + * @package Attachment Slugs/Admin * @since 0.0.1 - * @version 1.0.0 + * @version 2.0.0 */ if ( ! defined( 'ABSPATH' ) ) { @@ -17,6 +17,13 @@ class Attachment_Slug_Admin_Permalink_Settings { + /** + * Permalink settings. + * + * @var array + */ + private $permalinks = array(); + /** * Constructor */ @@ -31,14 +38,18 @@ public function __construct() { * @access public */ public function settings_init() { - add_settings_section( 'attachment-permalink', __( 'Attachment Permalink', 'attachment-slug' ), array( $this, 'settings' ), 'permalink' ); + add_settings_section( 'attachment-permalink', __( 'Attachment permalinks', 'attachment-slug' ), array( $this, 'settings' ), 'permalink' ); + + $this->permalinks = Attachment_Slug::aswp_get_permalink_structure(); } // END settings_init() /** * Clean variables using sanitize_text_field. * * @access public - * @param string|array $var + * + * @param string|array $var + * * @return string|array */ public function aswp_as_clean( $var ) { @@ -53,33 +64,34 @@ public function aswp_as_clean( $var ) { public function settings() { echo wpautop( __( 'These settings control the permalink used specifically for attachments.', 'attachment-slug' ) ); - $attachment_permalink = get_option( 'attachment_permalink' ); $base_slug = apply_filters( 'aswp_as_base_slug', 'image' ); $structures = array( 0 => '', - 1 => '/' . trailingslashit( $base_slug ), + 1 => trailingslashit( $base_slug ), ); ?>
+ | /?attachment=1 /sample-attachment/ |
|
---|---|---|
+ | //sample-attachment/ |
|
+ |
- must be set or WordPress will use default instead.', 'attachment-slug' ); ?>
+ /
+ must be set or WordPress will use default instead.', 'attachment-slug' ); ?>
|