Canonical Attachments
This plugin was developed to allow canonical tags as response headers to be created via htaccess for attachment files such as pdfs and docs. The plugin: Generates an htaccess file to manage the wp-content/uploads directory where these files are being uploaded Updates the htaccess file with canonical tags which are delivered via a header when the attachment is called Creates a dashboard where you can easily filter and find attachments without canonicals or that are not attached to a post. Creates a dashboard where you can easily attach a file to its parent post (one at a time or in bulk) or manually add/remove a canonical tag for a file Allows you to add a canonical url from the media file in the library or when you upload Creates a dashboard to edit the .htacess file directly for the uploads directory in case there are additional files in the directory that were uploaded outside of wordpress (e.g. during a site migration) The challenge: Analytics software such as Google Analytics, cannot track a user that enters a website via a pdf file in Google search results. Files cannot have a standard canonical tag added in the and instead the canonical tag has to be added via an http header when the file is requested from the server. In order to accomplish this, we need to have an htaccess file listening for a request to that file, and then sending the header. Expected outcome: PDF files and other attachments will be replaced in search results with the post or page counterparts, and we will be able to measure the traffic to those pages and provide calls to action for downloading the file, submitting contact forms, etc. Note: Canonical tags do not force a search engine to index one url vs. another, but act as a guideline/request to the search engine. As long as the attachment content is similar to the canonical URL, you should have no problem encouraging the search engines to choose the correct version. Future Features and Development Based on the feedback, we hope to continue developing additional features to support user requests. Current future feature ideas include: Automatic canonicalization of non-image files to attached post Integration with non-apache servers Canonical builder for non-wordpress media files Option to bulk delete canonical associations and delete htaccess on uninstall
Unique Headers
This plugin has been actively maintained since 2012 and is used on over 20,000 websites worldwide. Features The Unique Headers Plugin adds a custom header image box to the post/page edit screen. You can use this to upload a unique header image for that post, or use another image from your WordPress media library. When you view that page on the front-end of your site, the default header image for your site will be replaced by the unique header you selected. This functionality also works with categories and tags. Requirements You must use a theme which utilizes the built-in custom header functionality of WordPress. If your theme implement it’s own header functionality, then this plugin will not work with it. Paid WordPress development If you would like to pay for assistance, additional features to be added to the plugin or are just looking for general WordPress development services, please contact me via my contact form. Development This section is only relevant for developers building the plugin from source (e.g. cloning from GitHub). If you installed via WordPress.org, the plugin is ready to use — no build steps required. The plugin uses Composer for PHP autoloading and dependencies, npm for JavaScript tooling, and TypeScript for admin JavaScript. To set up a development environment: Install PHP dependencies: composer install Install JavaScript dependencies: npm install Compile TypeScript to JavaScript: npm run build To run tests and analysis: PHPCS (PSR-12 coding standards): composer phpcs Auto-fix PHPCS violations: composer phpcbf PHP-CS-Fixer (dry-run): composer cs PHP-CS-Fixer (auto-fix): composer cs:fix PHPStan static analysis: composer phpstan PHPUnit unit tests: composer test TypeScript type checking: npm run typecheck TypeScript source files are in src/ts/. The compiled output is written to assets/admin.js and is what WordPress loads on the admin side. Credits Thanks to the following for help with the development of this plugin: * redactuk – Assistance with debugging. * crabsallover – Assitance with debugging. * Todd – Assistance with implementing support for tags. * Mariano J. Ponce – Spanish translation. * Tobias Klotz – Deutsch (German) language translation. * Nadia Tokerud – Proof-reading of Norsk Bokmål (Norwegian) translation. * Bjørn Johansen – Proof-reading of Norwegian Bokmål translation. * Karl Olofsson – Proof-reading of Swedish translation. * Jenny Beaumont – French translation.