=== Shortcode Divi Library Layout for Divi 5 ===
Contributors: sewerel
Tags: divi, divi builder, divi 5, shortcode
Requires at least: 6.0
Tested up to: 6.9
Requires PHP: 7.4
Stable tag: 1.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Adds a shortcode to render Divi 5 library layouts anywhere and a quick “Copy Shortcode” column inside the Divi Library admin.

== Description ==

**Shortcode Divi Library Layout for Divi 5** allows you to embed any **Divi 5 Library layout** anywhere on your site using a simple shortcode: [divi_5_layout id="123"]

Perfect for:
* Reusing sections / modules inside other Divi layouts  
* Embedding layouts in posts, pages, Custom Post Types  
* Outputting Divi 5 Library templates programmatically or via other builders  
* Creating dynamic, reusable components  

This plugin also adds a **"Shortcode" column** to the Divi Library screen (`et_pb_layout` post type), allowing you to copy the shortcode instantly with one click.  
A small “Copied!” indicator confirms successful copy to clipboard.

### Key Features

- Adds `[divi_5_layout]` shortcode for Divi 5 layouts  
- Works with **Divi 5** (checks ET Core version before loading)  
- Safely renders the block content of library layouts  
- Properly handles **CSS generated** during Divi 5 module rendering  
- Adds a new **Shortcode column** in Divi Library admin  
- One-click copy to clipboard with visual feedback  
- Fallback rendering for preview / builder modes  

== Installation ==

1. Upload the plugin folder to `/wp-content/plugins/`
2. Activate the plugin through **Plugins → Installed Plugins**
3. Make sure you are running **Divi 5+**
4. Open **Divi → Divi Library**
5. Copy any shortcode from the new **Shortcode** column

== Usage ==

Place the shortcode anywhere shortcodes are supported: [divi_5_layout id="123"]


**Parameters**

- `id` — (required) The Divi Library layout post ID.

Example: [divi_5_layout id="2487"]


== Frequently Asked Questions ==

= Does this work with Divi 4? =
No.  
This plugin checks for Divi 5 (`ET_CORE_VERSION > 5.0`) before loading.  
Divi 4 uses a different rendering system incompatible with this shortcode.

= Does it work inside the Visual Builder? =
Yes.  
When in preview mode (`et_pb_preview`), the plugin captures Divi 5’s dynamic CSS to ensure modules render correctly.

= Can I nest library layouts inside other library layouts? =
Yes, as long as they do not produce circular self-references.

== Screenshots ==

1. The “Shortcode” column in the Divi Library with a one-click copy button.
2. Example usage inside a post or page editor.

== Changelog ==

= 1.0.0 =
* Initial release  
* Adds `[divi_5_layout]` shortcode  
* Adds shortcode column in Divi Library  
* Adds one-click clipboard copy  
* Handles Divi 5 CSS capture during dynamic block rendering  

== Upgrade Notice ==

= 1.0.0 =
Initial release. Safe to update.




