Skip to content

Latest commit

ย 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Asset Manager

A WordPress plugin for press kits and media pages โ€” publish logos, cover art and graphics as a searchable gallery with low-res, high-res and print-ready downloads for each one.

License PHP Lint Version 1.1.0 WordPress 5.0+ PHP 7.0+ Stars

Built by SureFire Studios


What it does

Hand journalists, partners or fans a single page where they can grab your brand assets in the format they actually need.

You add an asset once in the WordPress admin โ€” a preview thumbnail plus up to three downloadable files โ€” and drop [asset_gallery] on any page. Visitors get a searchable table showing the preview, each file's dimensions and size, and a direct download link per format.

Everything lives in the WordPress media library, so there is no separate uploader to learn.


โœจ Features

  • Three formats per asset โ€” web low-res, web high-res and print-ready, each optional, each with a customisable caption
  • Searchable gallery โ€” instant client-side filtering by title and description, with a debounced input and a "no results" message
  • File details shown up front โ€” pixel dimensions and human-readable file sizes are read from the media library automatically
  • Media library native โ€” files are picked with the standard WordPress media modal; nothing is uploaded outside it
  • Drag-and-drop ordering โ€” reorder assets with a handle, then save
  • Show / hide assets โ€” flip an asset to inactive to pull it from the public gallery without deleting it
  • Two layouts โ€” full-width or boxed (~1000px, centred), set globally or per shortcode
  • Light and dark โ€” ships both palettes, following the visitor's system preference by default, or pinned to one in Gallery Settings
  • Animated GIFs preserved โ€” GIF thumbnails bypass WordPress resizing so the animation survives
  • Responsive tables โ€” the table collapses to a stacked, labelled layout on small screens
  • Accessibility touches โ€” honours prefers-reduced-motion and prefers-contrast: high, plus lazy-loaded images and a print stylesheet
  • Guarded admin actions โ€” every write checks manage_options and verifies a nonce
  • Translation-ready โ€” all interface strings use the asset-manager text domain, with a .pot template included

Tip

Every colour is a CSS custom property, so you can rebrand the gallery from your theme without touching the plugin โ€” see Styling.


๐Ÿ“ฆ Requirements

  • WordPress 5.0 or higher
  • PHP 7.0 or higher
  • MySQL / MariaDB (the plugin creates one custom table)
  • A browser with JavaScript enabled โ€” search, media pickers and reordering all rely on it

๐Ÿš€ Installation

From this repository

  1. Download the repository as a ZIP (Code โ†’ Download ZIP), or clone it:
    git clone https://github.com/SurefireStudios/AssetManager.git asset-manager
  2. Place the folder in wp-content/plugins/ so you end up with wp-content/plugins/asset-manager/asset-manager.php.
  3. Activate Asset Manager under Plugins in the WordPress admin.
  4. A new Asset Manager item appears in the admin sidebar.

Uploading the GitHub ZIP through Plugins โ†’ Add New โ†’ Upload Plugin also works โ€” WordPress just names the folder AssetManager-main, which is harmless.

On activation the plugin creates the table {prefix}_asset_manager_assets. Deactivating leaves it in place, so your assets survive a deactivate/reactivate cycle โ€” deleting the plugin removes the table and its option cleanly.


๐Ÿ“– Usage

1. Add an asset

Go to Asset Manager in the admin sidebar and fill in the form on the left:

Field Notes
Asset Title Required. Shown in the gallery, e.g. "Zoom Suit Logo" or "Issue 1 Cover A"
Description Optional. Good for artist credits โ€” shown under each download
Preview Thumbnail The image shown in the gallery. Can differ from the downloadable files
Low-Res File Web-optimised version (JPG / PNG)
High-Res File Higher-quality web version
Print Ready File Print-quality file (PDF / EPS / TIFF)
Button Label (per file) Caption shown beside that download โ€” defaults to Web Low-Res, Web High-Res, Print Ready
Active Untick to keep the asset out of the public gallery

Every file is optional. Columns with no file attached are simply left empty for that asset.

2. Display the gallery

Put the shortcode on any page or post:

[asset_gallery]

Shortcode attributes

Attribute Values Default Description
limit any number -1 (all) Maximum number of assets to show
search true / false true Show or hide the search box
layout full-width / boxed Gallery Settings value Override the global layout for this gallery
scheme auto / light / dark Gallery Settings value Override the global colour scheme for this gallery
[asset_gallery limit="10"]
[asset_gallery search="false"]
[asset_gallery layout="boxed"]
[asset_gallery scheme="dark"]
[asset_gallery limit="6" layout="full-width" scheme="light" search="false"]

Only active assets appear, ordered by the sort order you set in the admin.

3. Manage assets

  • Edit โ€” click Edit beside an asset to load it into the form
  • Delete โ€” click Delete (asks for confirmation)
  • Reorder โ€” drag assets by the โ‹ฎโ‹ฎ handle, then click Save Order to apply it. The order is not saved until you click the button
  • Hide โ€” untick Active and update

โš™๏ธ Configuration

Gallery Settings

One global setting, under Gallery Settings on the admin page:

Layout

Option Behaviour
Full Width (default) Gallery spans the full width of its container
Boxed Gallery is centred and capped at ~1000px

Colour Scheme

Option Behaviour
Auto (default) Follows each visitor's system light/dark preference
Light Always uses the light palette
Dark Always uses the dark palette

Pick the one that matches your theme. If your site is always dark (or always light), choose that explicitly โ€” Auto follows the visitor's device setting, which won't match a site that only has one look.

The layout and scheme shortcode attributes override these per gallery.

Styling

Every colour in the gallery comes from a CSS custom property, so you can rebrand it from your theme's stylesheet without editing the plugin or fighting specificity:

.asset-manager-gallery {
    --am-link: #c2410c;      /* download buttons */
    --am-accent: #7c3aed;    /* focus ring, mobile section headings */
    --am-surface: #faf7f2;   /* cards and table header */
}

The full token list is documented at the top of assets/public-style.css. The stylesheet uses no !important at all, so a more specific rule of your own will always win.


๐Ÿงฐ Tech stack

Layer Used
Platform WordPress plugin โ€” plain PHP, no build step, no dependencies
Backend PHP with $wpdb, dbDelta, shortcode and AJAX APIs
Frontend jQuery (bundled with WordPress), vanilla CSS
Admin UI WordPress media modal (wp_enqueue_media) and jQuery UI Sortable
Storage One custom table plus a single option

Under the hood

Table {prefix}_asset_manager_assets โ€” one row per asset:

Column Purpose
id Primary key
title, description Text shown in the gallery
thumbnail_id, low_res_id, high_res_id, print_ready_id WordPress attachment IDs
low_res_label, high_res_label, print_ready_label Per-file captions
is_active Visibility in the public gallery
sort_order Display order
created_at, updated_at Timestamps

Option asset_manager_layout_type โ€” full-width or boxed.

Because assets reference media library attachment IDs, deleting the underlying media in WordPress will empty that download column.


๐Ÿ—‚ Project structure

AssetManager/
โ”œโ”€โ”€ asset-manager.php          # Plugin header, activation, shortcode, AJAX, table schema
โ”œโ”€โ”€ uninstall.php              # Drops the table and option when the plugin is deleted
โ”œโ”€โ”€ admin/
โ”‚   โ””โ”€โ”€ admin-page.php         # Admin screen: add/edit form, settings, asset list
โ”œโ”€โ”€ public/
โ”‚   โ””โ”€โ”€ public-display.php     # Front-end gallery markup
โ”œโ”€โ”€ assets/
โ”‚   โ”œโ”€โ”€ admin-style.css        # Admin styles
โ”‚   โ”œโ”€โ”€ admin-script.js        # Media pickers, sortable list, save-order
โ”‚   โ”œโ”€โ”€ public-style.css       # Gallery styles (dark)
โ”‚   โ””โ”€โ”€ public-script.js       # Gallery search
โ”œโ”€โ”€ languages/
โ”‚   โ””โ”€โ”€ asset-manager.pot      # Translation template
โ”œโ”€โ”€ .github/workflows/         # PHP lint CI
โ”œโ”€โ”€ CONTRIBUTING.md
โ”œโ”€โ”€ SECURITY.md
โ”œโ”€โ”€ LICENSE
โ””โ”€โ”€ README.md

๐Ÿฉบ Troubleshooting

Symptom Try this
Gallery renders nothing Confirm at least one asset exists and is marked Active
Colours don't match the site Set Gallery Settings โ†’ Color Scheme to Light or Dark instead of Auto, or override the CSS tokens โ€” see Styling
No Asset Manager menu The menu requires the manage_options capability (administrator)
Media picker won't open Check the browser console for a JavaScript error from another plugin
Layout looks broken Test with a default theme such as Twenty Twenty-Four to rule out a theme conflict

For professional support or custom development, visit SureFire Studios.


๐Ÿ“ Changelog

1.1.0

Theme-agnostic styling

  • The gallery now ships light and dark palettes instead of forcing dark on every site. Colours come from CSS custom properties, so a light theme renders correctly out of the box.
  • New Color Scheme setting (Auto / Light / Dark) in Gallery Settings, plus a scheme shortcode attribute. Auto follows the visitor's prefers-color-scheme.
  • Removed all 260 !important declarations. The stylesheet now wins on specificity alone, so your own CSS can override it normally.
  • The gallery declares color-scheme, so native controls (the search box) render correctly and browsers won't force-invert it.
  • Both palettes meet WCAG AA contrast on every text pair; added a visible focus ring on download buttons.

1.0.1

Fixes

  • Reordering now saves. The update_asset_order AJAX handler was registered inside admin/admin-page.php, which only loads while the Asset Manager screen renders โ€” never during an admin-ajax.php request. Dragging and clicking Save Order always failed. The handler now lives in asset-manager.php.
  • Two galleries on one page no longer fatal. asset_manager_format_file_size() was declared unguarded in a file included once per shortcode, so a second [asset_gallery] triggered a "cannot redeclare" fatal error.
  • Empty galleries show their message. The "No assets available" text was returned from inside an output buffer, which discarded it and rendered nothing.

Improvements

  • Interface strings are now translatable via the asset-manager text domain, with languages/asset-manager.pot included
  • Added uninstall.php so deleting the plugin removes its table and option (multisite aware)
  • Added Requires at least, Requires PHP and License URI plugin headers
  • Plugin header licence now matches the bundled LICENSE (GPLv3 or later)
  • AJAX handlers check that nonce is present before verifying it

1.0.0

  • Initial release

๐Ÿค Contributing

Issues and pull requests are welcome. The most useful contributions right now:

  • Translations โ€” the template is at languages/asset-manager.pot
  • Keyboard support for the drag-and-drop reordering list
  • Testing against current WordPress releases
  • Bulk actions in the admin (delete or toggle several assets at once)

CONTRIBUTING.md covers local setup, the coding conventions, and how to run the same lint CI uses. Every push and pull request is syntax-checked on PHP 7.0, 7.4 and 8.3 by the PHP Lint workflow.

Caution

Found a security vulnerability? Don't open a public issue โ€” follow SECURITY.md to report it privately.


๐Ÿ“„ License

Released under the GNU General Public License v3.0 โ€” see LICENSE for the full text.


๐Ÿ”— Links

Built by SureFire Studios โ€” professional WordPress development and digital solutions.

About

A simple and user-friendly WordPress plugin for managing and displaying assets like logos, comic book covers, and graphics with multiple download formats.

Topics

Resources

Contributing

Security policy

Stars

5 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages