=== PDF Menu Linker ===
Contributors: webgodjj
Tags: pdf, menus, navigation, media library
Requires at least: 6.0
Tested up to: 6.9
Stable tag: 1.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Quickly add and manage PDF links in WordPress navigation menus via a dedicated PDFs panel.

== Description ==

PDF Menu Linker is a small admin-only plugin that makes it easy to add and manage **PDF links in navigation menus**.

It adds a dedicated **PDFs** panel to **Appearance → Menus**, and a **Replace PDF** control on PDF menu items, so you can swap files without recreating menu items or touching URLs manually.

= Features =

* **PDFs panel on the Menus screen** – Select a PDF from the Media Library and add it directly to any navigation menu.
* **Automatic link text and title** – Link Text and Link Title fields default from the PDF filename (without the extension), and can be edited before adding.
* **One-click Add to Menu** – Creates a standard custom menu item that opens the PDF in a new tab, using WordPress core menu APIs.
* **Replace PDF on existing items** – For custom links that point to a `.pdf`, a **Replace PDF** button appears next to the URL field so you can change the file without changing labels.
* **Native WordPress UX** – Uses WordPress’ Media Library, menu editor, styling, permissions, and nonces. No custom tables or front‑end changes.

= Requirements =

* WordPress 6.0 or higher
* PHP 7.4 or higher
* A user role with permission to manage menus (typically users who can `edit_theme_options`).

== Installation ==

1. Upload the `pdf-menu-linker` folder to the `/wp-content/plugins/` directory, or install the plugin via the Plugins screen.
2. Activate **PDF Menu Linker** through the **Plugins → Installed Plugins** screen.

== Usage ==

= Add a new PDF menu item =

1. In the WordPress admin, go to **Appearance → Menus**.
2. Ensure a menu is selected (or create one and save it).
3. In the **Add menu items** column, open the **PDFs** panel.
4. Click **Select PDF** and choose a file from the Media Library (PDFs only).
5. Optionally adjust **Link Text** and **Link Title**.
6. Click **Add to Menu**.
7. A new **Custom Link** pointing at the PDF will appear at the bottom of the menu structure and will open in a new tab on the front end.

= Replace the PDF for an existing menu item =

1. In **Appearance → Menus**, locate a **Custom Link** whose URL ends with `.pdf`.
2. Expand the menu item.
3. Click **Replace PDF** next to the URL field.
4. Choose a new PDF from the Media Library and confirm.
5. The URL field updates to the new PDF, while **Navigation Label** and **Title Attribute** remain unchanged.

== Frequently Asked Questions ==

= Does this plugin change how menus render on the front end? =

No. The plugin only runs in the admin and creates standard custom menu items that WordPress already knows how to render.

= Where are PDFs and menu items stored? =

PDFs are normal media attachments in the Media Library, and menu items are standard `nav_menu_item` posts with their usual meta fields. The plugin does not create custom tables.

== Changelog ==

= 1.0 =
* Initial release.
