=== WP Add Custom CSS and JS ===
Contributors: d3logics, vinit-sharma, devshubham715
Donate link: https://d3logics.com
Tags: custom css, custom js, custom javascript, add css, minify css
Requires at least: 4.7
Tested up to: 6.8
Requires PHP: 7.0
Stable tag: 2.0.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Add unlimited custom CSS and custom JavaScript snippets to WordPress from the admin panel, with a code editor, per-snippet options, and automatically minified output.

== Description ==

**WP Add Custom CSS and JS** lets you add custom CSS and custom JavaScript to your WordPress website directly from the admin panel — no need to edit your theme, child theme, or plugin files. Write your code in a clean, syntax-highlighting editor and it is applied to your whole site instantly.

Unlike most custom CSS plugins, every time you publish your code it is **automatically minified (compressed)**. Your custom CSS and JS are saved to static, cached files and served minified on the front end, so your tweaks never slow your site down — no extra database queries on each page load.

= Why use this plugin? =

* **Add custom CSS** to restyle your theme without touching theme files.
* **Add custom JavaScript** for tracking codes, animations, widgets and tweaks.
* Your code is **kept safe when you switch or update your theme**.
* Perfect for quick fixes, design tweaks, and adding third-party snippets.

= Key Features =

* **Unlimited snippets** — add as many separate custom CSS and JS codes as you want.
* **Management screen** — every snippet is listed in an easy table (like Posts) where you can edit, enable/disable, and delete.
* **Syntax-highlighting code editor** (powered by CodeMirror) with line numbers, bracket matching and search.
* **Per-snippet options:**
    * Print the code **inline (internal)** or save it to an **external cached file**.
    * Load the code in the **header** or the **footer**.
    * Apply the code on the **front end**, the **admin** area, or **both**.
* **Automatic minification** — output is compressed for the fastest possible load time.
* **External files are cached** — no database queries on the front end, so there is no performance hit.
* **Keeps your code when you switch themes.**
* **Secure** — capability checks and WordPress nonces on every action.
* **Lightweight** and works with any theme.

= Who is it for? =

Anyone who wants to add custom CSS or JavaScript to WordPress the easy way: site owners, designers, developers, and agencies who need a fast, safe place to keep custom code separate from the theme.

== Installation ==

1. From the WordPress admin, go to **Plugins → Add New** and search for "WP Add Custom CSS and JS", or upload the plugin ZIP.
2. Click **Install Now**, then **Activate**.
3. A new **Custom CSS JS** menu appears in your admin sidebar.
4. Open **Custom CSS** to add CSS, or **Custom JS** to add JavaScript.
5. Write your code and click **Save & Publish**. Your minified code is applied to the site immediately.

== Frequently Asked Questions ==

= Does this plugin support custom CSS? =

Yes. Go to **Custom CSS JS → Custom CSS**, write your CSS, and click Save & Publish.

= Does this plugin support custom JavaScript? =

Yes. Go to **Custom CSS JS → Add Custom JS**, write your JS, and click Publish.

= Can I add more than one CSS or JS code? =

Yes. You can add as many separate snippets as you want. Each one has its own title, options, and on/off state, and they are all listed in the management table.

= What is the difference between Internal and External? =

**Internal** prints the code inline directly in the page. **External** saves the code to a cached `.css`/`.js` file that is loaded as a normal file — best for larger code and performance.

= Does it minify (compress) my code? =

Yes. With "Minify output" enabled (the default), each snippet is compressed when you save it.

= Will it slow down my site? =

No. External snippets are served as cached static files, and minified output keeps them small.

= Will my code be lost if I change my theme? =

No. Your custom CSS and JS are stored independently of the theme, so they remain active when you switch or update themes.

= Who can edit the code? =

Only administrators (users with the `edit_theme_options` capability) can add or change the custom CSS/JS.

== Screenshots ==

1. The management table listing all your custom CSS and JS snippets.
2. The code editor with syntax highlighting and per-snippet options.

== Changelog ==

= 2.0.0 =
* New: Add **unlimited** custom CSS and JS snippets, each managed from a list table like Posts.
* New: **Per-snippet options** — internal (inline) or external (cached file), header or footer, and front end / admin / both.
* New: Each snippet can be enabled or disabled independently.
* New: Existing CSS/JS from version 1.x is automatically imported into snippets on upgrade.
* Improved: Cleaner CodeMirror editor with live language switching.
* Security: Capability checks and nonce verification throughout.

= 1.1.0 =
* New: Published CSS and JS are now **always minified (compressed)** automatically for faster page loads.
* Fix: Removed `get_magic_quotes_gpc()`, which caused a fatal error on PHP 8.0+ when saving code.
* Fix: Corrected undefined-variable and `array_map` bugs in the publish handler.
* Security: Added WordPress nonce verification to all AJAX actions (save, publish, delete, get revisions).
* Security: Escaped all admin-page output and properly unslashed all request data.
* Live preview is now restricted to logged-in administrators.
* Updated compatibility to WordPress 6.8 and set Requires PHP to 7.0.

= 1.0.1 =
* Minor fixes.

= 1.0.0 =
* Initial release.

== Upgrade Notice ==

= 2.0.0 =
Major update: add unlimited CSS/JS snippets with per-snippet options (internal/external, header/footer, frontend/admin) and automatic minification. Your existing code is imported automatically. Upgrade recommended.

= 1.1.0 =
Important update: fixes a fatal error on PHP 8+, adds automatic CSS/JS minification, and hardens security with nonce verification. Upgrade recommended for all users.
