1. Overview
The Smart Policies Plugin is our tool designed to organise, group, and display policy documents (PDFs, DOCX, etc.). It renders lists on the frontend using a clean, searchable interface similar to our "Smart OneDrive Selector."
Key features
Manage a list of policy files in one place (a CPT called
Policy Manager).Friendly display names independent from the file names.
Copy‑paste shortcode for embedding on any page.
Optional cross‑site sharing: publish a Policy Group from Site A, and display it on Site B using a simple per‑group key (great for MATs).
Remote rename capability: on a consumer site you can update the displayed names, while the owner site retains full control for adding/removing files.
2. Creating a Policy Group
Make sure you have "Smart Policies Plugin" enabled from your website Plugins admin area.
Navigate to Policy Manager in the left-hand WordPress admin menu.
Click Add New Policy Group.
Enter a Title: Give your group a name (e.g., "HR Policies 2024" or "Health & Safety").
Visibility: By default, new groups are set to Private, as they are embedded on pages as a shortcode.

3. Managing Files
Inside the "Edit Policy Group" screen, locate the Policy Group Files box.
Adding Files:
Click the Add Files button.
The WordPress Media Library will open. Select one or multiple files from your Media Library.
Alternatively go to the "Upload Files" tab and upload your files.
Click "Select".
The files will appear in the list below. The plugin references the existing file URL (it does not re-upload the file, keeping your storage efficient).
Renaming Files:
The "Display Name" defaults to the filename.
To change how the file looks on the frontend, type a new name in the text box under Display Name.
Click the Save Name button next to the field to persist the change.
Removing Files:
Click the Remove button to take a file out of this specific group. This does not delete the file from your Media Library, only from this list.

4. Displaying the Policies (Shortcode)
To display the list on a page or post, copy the shortcode shown in the meta box:
[smart_policies id="123"]
Shortcode Attributes
You can customise the display using the following attributes:
Attribute | Default | Description |
| (Required) | The ID of the Policy Group you want to display. |
|
| Set to |
|
| Sort files by |
|
| Sort direction: |
|
| Add custom CSS classes to the wrapper div. |
Example:
ng-tns-c1983303472-20[smart_policies id="45" show_title="true" orderby="added" order="desc"]5. Sharing a Policy Group to Other Sites
Use this when your site owns the list of policies, and you want other sites (schools in your MAT) to embed them.

Open your Policy Group in Admin → Policy Manager and locate the “Sharing (Cross‑site)” metabox.
Tick “Enable sharing this Policy Group to other sites”.
Leave “Shared key” blank to auto‑generate, or paste your own (keep it secret; it works like a password). Save/Update the post.
Copy the example consumer shortcode shown in the metabox — it looks like this:
JavaScript[smart_policies source_url="https://owner-school.example" remote_id="10095" key="YOUR_GENERATED_KEY" show_title="true"]Send that shortcode (or the three values:
source_url,remote_id,key) to the other site’s editor.Security notes
The per‑group key is required for both reading and (limited) remote renaming. Keep it private.
You can rotate the key by entering a new one and updating the post (consumers must then update their shortcode).
6. Consuming The Policy Group On Another Site
There are two convenient ways to consume a remote group.
Paste the shortcode directly on the page
JavaScript[smart_policies source_url="https://owner-school.example" remote_id="10095" key="SHARED_KEY" cache_ttl="900" show_title="true"]
Save a Cross-Site Preview
The list will load from the owner site using the shared key.
Save a "Cross-site Preview" entry
Go to: Policy Manager -> Cross-site Preview -> Add Cross-site Policy Group
Enter the label (optional), Source URL, Remote Group ID, and Key, then Save.
You're redirected to the Cross-site list, where you can
Preview the latest file list from the owner site.
Copy a ready-made shortcode
Delete the saved entry at any time
Caching & Performance
The shortcode support cache_ttl (seconds). For example 900 would cache the fetched items for 15 minutes.
You can set a timeout for retrieving the files, so that the page will load even if there is an issue with the source url using timeout.
Editors can bypass the preview cache by using the "Refresh" button in the preview screen.
7.Frontend Features
Live Search: A search bar at the top allows users to filter files by name instantly.
Preview: Clicking the Eye Icon opens the document in a new tab.

8.S3 And Storage Notes
Each site typically points to a different S3 bucket via the
BUCKETenvironment variable.That’s fine: consuming a remote group doesn’t copy binaries between buckets — it simply references the file URLs (often already on a shared CDN).
Adding files happens on the owner site using its own bucket and Media Library.
9.Troubleshooting
“No files yet” after adding: ensure you clicked Update/Publish on the Policy Group.
Remote site shows an error:
Check the
source_url,remote_id, andkeyare correct.Ensure the owner site has sharing enabled for that group.
Verify the site is reachable over HTTPS.
Changes not appearing:
If using
cache_ttl, wait until cache expires or temporarily setcache_ttl="0"to disable caching.On the preview screen, use the “Refresh (bypass cache)” button.
Can’t add/remove on consumer site:
This is by design. Only the owner site can add/remove. Consumer sites can rename display names if needed.
S3 warnings in admin:
If you see notices about missing
BUCKET,ACCESS_KEY, orSECRET_KEY, contact your Realsmart to set environment variables.
10.Shortcode Reference
Local group (same site):
text[smart_policies id="123" show_title="true" orderby="name" order="asc"]
Remote group (owner site is another domain):
text[smart_policies
source_url="https://owner-school.example"
remote_id="10095"
key="SHARED_KEY"
cache_ttl="900"
timeout="10"
show_title="true"
orderby="name"
order="asc"
]Attributes
id(number): Local Policy Group post ID.source_url(string): Base URL of the owner site (e.g.,https://school.example).remote_id(number): Policy Group ID on the owner site.key(string): Shared key from the owner site’s Sharing box.cache_ttl(seconds, default 900): Cache duration. Use0to disable.timeout(seconds, default 10): Remote fetch timeout.show_title(true|false): Show the group title above the list.orderby(name|added): Sort by name or by date added.order(asc|desc): Sort direction.