Skip to content
Back to skills

Skill: Flatsome UX Element

ASecurity

This skill guides the creation of custom UX Builder elements for the Flatsome theme within the PolyUtilities plugin.

  • 26 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added February 7, 2026
developmentgophpangularfrontend

Works with

  • cli

Security analysis

A100/100

Pro scans all 21 files and shows the line behind each finding

Scanned February 10, 2026

npx -y skills add PolyXGO/HeraSpec --skill ux-element --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Skill: Flatsome UX Element?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Skill: Flatsome UX Element
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/polyxgo-skill-flatsome-ux-element/badge)](https://www.skillsdirectory.com/skills/polyxgo-skill-flatsome-ux-element)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
# Skill: Flatsome UX Element

This skill guides the creation of custom UX Builder elements for the Flatsome theme within the PolyUtilities plugin.

## Purpose
Standardize the development of UX elements to ensure consistency across controllers, shortcodes, and templates, with special focus on real-time preview functionality. This skill is portable and uses dynamic prefixes for identity (Shortcode, Namespace, CSS Classes).

## Required Variables
When calling this skill, define the following identity prefixes:
- `{{namespace_prefix}}`: The root namespace (e.g., `polyxgo\PolyUtilities`).
- `{{shortcode_prefix}}`: Prefix for shortcode names (e.g., `poly_ux_`).
- `{{class_prefix}}`: Prefix for CSS classes (e.g., `poly-`).
- `{{plugin_dir_const}}`: The plugin directory constant (e.g., `__POLYUTILITIES_PLUGIN_DIR__`).

## Prerequisites
- Knowledge of PHP, WordPress Shortcodes, and AngularJS (for UX Builder templates).
- Access to `inc/Core/Helper.php` for utility functions.

## Implementation Steps

### 1. Register Shortcode Logic (The Controller)
Create a new controller class in `inc/Controllers/Elements/`.
- **Namespace**: `{{namespace_prefix}}\Controllers\Elements`
- **Method `register_hooks()`**: Add the shortcode `{{shortcode_prefix}}{{element_slug}}` and `ux_builder_setup` action.
- **Method `render_element($atts, $content)`**: Handle the frontend output.

### 2. Register UX Builder UI (The Shortcode)
Create a registration file in `inc/builder/shortcodes/`.
- Use `add_ux_builder_shortcode('{{shortcode_prefix}}{{element_slug}}', ...)`.
- Define options (textfield, select, colorpicker, slider, etc.).
- Link to the AngularJS template using `Helper::get_poly_ux_builder_template()`.

### 3. Build the Preview Template (AngularJS)
Create an HTML file in `inc/builder/shortcodes/templates/`.
- **CRITICAL**: Wrap the entire content in a `<span>` with `id="{{:: shortcode.$id }}"`.
- This ensures that clicking the element in the builder correctly selects it and shows options.
- Use `ng-style` and `style scope="scope"` for real-time CSS updates.

### 4. Create SVG Thumbnail
Create an SVG file in `inc/builder/shortcodes/thumbnails/`.
- **Naming**: Use `{{element_slug}}.svg`.
- **Dimensions**: Use `100x68px`.
- **Theme**: Use the "Pastel Red" theme (`#F87171` for accents, `#FCA5A5` for fills).

### 5. Create the Frontend View
(Optional) Extract the HTML into `inc/Views/elements/` for cleaner controllers.

## Standards and Rules

### The Wrapping Rule
Every UX Builder template MUST follow this structure:
```html
<span id="{{:: shortcode.$id }}">
    <!-- Main element (e.g., <a>, <div>, <section>) -->
    <div class="{{class_prefix}}{{element_slug}}" ng-style="{ 'color': shortcode.options.color }">
        {{ shortcode.options.text }}
    </div>
    
    <!-- Scoped styles for hover effects or complex rules -->
    <style scope="scope">
        #{{::shortcode.$id }} .{{class_prefix}}{{element_slug}}:hover {
            opacity: 0.8;
        }
    </style>
</span>
```

### Variable Naming (PHP vs AngularJS)
**CRITICAL**: When accessing shortcode options in the AngularJS template (`.html`), variables declared with underscores (`_`) in PHP MUST be accessed via **camelCase**.
- **PHP**: `bg_color` → **AngularJS**: `shortcode.options.bgColor`
- **PHP**: `pxg_clock_font` → **AngularJS**: `shortcode.options.pxgClockFont`
- **PHP**: `text_align` → **AngularJS**: `shortcode.options.textAlign`

### Color Handling
- Use HEX or RGBA strings consistently.
- Always provide default values in the shortcode registration or handle them in the template/controller.

## Templates
- [Controller.php](templates/Controller.php)
- [Shortcode.php](templates/Shortcode.php)
- [Template.html](templates/Template.html)
- [View.php](templates/View.php)
- [Thumbnail.svg](templates/Thumbnail.svg)

Files in this skill

  • CHANGELOG.md3 KB
  • README-template.md1.4 KB
  • README.md1.8 KB
  • content-optimization-skill.md3 KB
  • data/charts.csv7.5 KB
  • data/colors.csv12.7 KB
  • data/landing.csv14.1 KB
  • data/pages-proposed.csv11.1 KB
  • data/pages.csv5 KB
  • data/products.csv29.1 KB
  • data/prompts.csv17 KB
  • data/stacks/flutter.csv10.2 KB
  • data/stacks/html-tailwind.csv11.1 KB
  • data/stacks/nextjs.csv12.3 KB
  • data/stacks/react-native.csv9.8 KB
  • data/stacks/react.csv12.7 KB
  • data/stacks/svelte.csv10.8 KB
  • data/stacks/swiftui.csv10.6 KB
  • data/stacks/vue.csv10.8 KB
  • data/styles.csv41 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.