Token导航 LogoToken导航TokenDH.com
研究检索权限需确认github未标认证来源可访问许可证需确认审计通过

elementor-themes元素主题

Agent Skill

elementor-themes 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

612

周安装

25

GitHub Stars

3

下载量

198
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:elementor-themes(元素主题)
来源仓库:https://github.com/peixotorms/odinlayer-skills
仓库路径:skills/elementor-themes
安装命令:
npx skills add https://github.com/peixotorms/odinlayer-skills --skill elementor-themes
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/peixotorms/odinlayer-skills --skill elementor-themes

简介

elementor-themes 提供主题构建器位置注册与核心区域管理的开发规范。

  • 适用于自定义页眉、页脚或侧边栏等主题区域的动态内容绑定。
  • 通过 npx skills add 命令从 GitHub 安装,需确认仓库权限与网络访问能力。
  • 使用前应核实维护状态及是否涉及文件读写、命令执行等敏感操作。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

1. Theme Builder Locations

Registering Locations

Register all core locations at once:

function theme_prefix_register_elementor_locations( $elementor_theme_manager ) {
    $elementor_theme_manager->register_all_core_location();
}
add_action( 'elementor/theme/register_locations', 'theme_prefix_register_elementor_locations' );

Register specific locations or custom locations:

$elementor_theme_manager->register_location( 'header' );
$elementor_theme_manager->register_location( 'footer' );
$elementor_theme_manager->register_location( 'main-sidebar', [
    'label' => esc_html__( 'Main Sidebar', 'theme-name' ),
    'multiple' => true,        // allow multiple templates (default: false)
    'edit_in_content' => false, // edit in content area (default: true)
] );

Location Types

LocationReplaces
headerheader.php
footerfooter.php
singlesingular.php, single.php, page.php, attachment.php, 404.php
archivearchive.php, taxonomy.php, author.php, date.php, search.php

Displaying Locations with Fallback

<?php
if ( ! function_exists( 'elementor_theme_do_location' ) || ! elementor_theme_do_location( 'archive' ) ) {
    get_template_part( 'template-parts/archive' );
}
?>

elementor_theme_do_location() returns true if a template was displayed, false otherwise.

Migration: Functions Method

Use elementor_theme_do_location() with fallback in header.php, footer.php, single.php, archive.php:

<!-- header.php -->
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
    <meta charset="<?php bloginfo( 'charset' ); ?>">
    <?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php
if ( ! function_exists( 'elementor_theme_do_location' ) || ! elementor_theme_do_location( 'header' ) ) {
    get_template_part( 'template-parts/header' );
}
?>

Migration: Hooks Method

Register locations with hook and remove_hooks parameters to auto-replace theme output:

$elementor_theme_manager->register_location( 'header', [
    'hook' => 'theme_prefix_header',
    'remove_hooks' => [ 'theme_prefix_print_elementor_header' ],
] );

2. Theme Conditions

Class Structure

Extend \ElementorPro\Modules\ThemeBuilder\Conditions\Condition_Base.

Required methods:

MethodReturnsPurpose
get_type()stringCondition group: general, singular, archive
get_name()stringUnique condition identifier
get_label()stringDisplay label
check($args)boolEvaluate if condition matches
get_all_label()stringLabel for "All" option (parent conditions only)
register_sub_conditions()voidRegister child conditions

Registration

function register_new_theme_conditions( $conditions_manager ) {
    require_once( __DIR__ . '/theme-conditions/my-condition.php' );
    $conditions_manager->get_condition( 'general' )->register_sub_condition( new \My_Condition() );
}
add_action( 'elementor/theme/register_conditions', 'register_new_theme_conditions' );

Condition Groups

IDLabelDescription
generalGeneralEntire site conditions
archiveArchivesArchive page conditions
singularSingularSingle page/post conditions

Simple Example: 404 / Front Page

class Front_Page_Condition extends \ElementorPro\Modules\ThemeBuilder\Conditions\Condition_Base {
    public static function get_type(): string { return 'general'; }
    public function get_name(): string { return 'front_page'; }
    public function get_label(): string { return esc_html__( 'Front Page', 'textdomain' ); }
    public function check( $args ): bool { return is_front_page(); }
}

class Not_Found_Condition extends \ElementorPro\Modules\ThemeBuilder\Conditions\Condition_Base {
    public static function get_type(): string { return 'general'; }
    public function get_name(): string { return 'not_found_404'; }
    public function get_label(): string { return esc_html__( '404 Page', 'textdomain' ); }
    public function check( $args ): bool { return is_404(); }
}

Advanced Example: Parent with Sub-Conditions

class Logged_In_User_Condition extends \ElementorPro\Modules\ThemeBuilder\Conditions\Condition_Base {
    public static function get_type(): string { return 'general'; }
    public function get_name(): string { return 'logged_in_user'; }
    public function get_label(): string { return esc_html__( 'Logged-in User', 'textdomain' ); }
    public function get_all_label(): string { return esc_html__( 'Any user role', 'textdomain' ); }

    public function register_sub_conditions(): void {
        global $wp_roles;
        if ( ! isset( $wp_roles ) ) { $wp_roles = new \WP_Roles(); }
        foreach ( $wp_roles->get_names() as $role ) {
            $this->register_sub_condition( new \User_Role_Condition( $role ) );
        }
    }

    public function check( $args ): bool { return is_user_logged_in(); }
}

class User_Role_Condition extends \ElementorPro\Modules\ThemeBuilder\Conditions\Condition_Base {
    private $user_role;
    public function __construct( $user_role ) { parent::__construct(); $this->user_role = $user_role; }
    public static function get_type(): string { return 'logged_in_user'; }
    public function get_name(): string { return strtolower( $this->user_role . '_role' ); }
    public function get_label(): string { return sprintf( esc_html__( '%s role', 'textdomain' ), $this->user_role ); }
    public function check( $args ): bool {
        $current_user = wp_get_current_user();
        return in_array( $this->user_role, (array) $current_user->roles );
    }
}

3. Dynamic Tags

Class Structure

Extend \Elementor\Core\DynamicTags\Tag.

Required methods:

MethodReturnsPurpose
get_name()stringUnique tag identifier
get_title()stringDisplay title
get_group()arrayGroups this tag belongs to
get_categories()arrayData type categories
render()voidOutput the dynamic value (echo)
register_controls()voidOptional: add tag settings

Dynamic Tag Categories

ConstantValueUse For
Module::NUMBER_CATEGORYnumberNumeric values
Module::TEXT_CATEGORYtextText strings
Module::URL_CATEGORYurlURLs
Module::COLOR_CATEGORYcolorColor values
Module::IMAGE_CATEGORYimageImage data
Module::MEDIA_CATEGORYmediaMedia files
Module::GALLERY_CATEGORYgalleryImage galleries
Module::POST_META_CATEGORYpost_metaPost meta fields

Full constant path: \Elementor\Modules\DynamicTags\Module::CATEGORY_NAME.

Registration

function register_dynamic_tags( $dynamic_tags_manager ) {
    require_once( __DIR__ . '/dynamic-tags/my-tag.php' );
    $dynamic_tags_manager->register( new \My_Dynamic_Tag() );
}
add_action( 'elementor/dynamic_tags/register', 'register_dynamic_tags' );

Register Custom Group

function register_custom_dynamic_tag_group( $dynamic_tags_manager ) {
    $dynamic_tags_manager->register_group( 'my-group', [
        'title' => esc_html__( 'My Group', 'textdomain' ),
    ] );
}
add_action( 'elementor/dynamic_tags/register', 'register_custom_dynamic_tag_group' );

Controls in Dynamic Tags

Use $this->add_control() in register_controls() and $this->get_settings('key') in render().

Code Examples

See resources/dynamic-tags.md for complete examples: Simple tag (Random Number), Advanced tag with controls (ACF Average), Complex tag with SELECT control (Server Variables), and unregistering tags.

4. Finder

Class Structure

Extend \Elementor\Core\Common\Modules\Finder\Base_Category.

MethodReturnsPurpose
get_id()stringUnique category identifier
get_title()stringDisplay title
get_category_items(array $options = [])arrayItems in this category
is_dynamic()boolIf true, items loaded via AJAX on search

Item Properties

PropertyTypeRequiredDescription
titlestringYesDisplayed to user
iconstringNoIcon before title
urlstringYesLink URL
keywordsarrayNoSearch keywords

Registration

function register_finder_category( $finder_categories_manager ) {
    require_once( __DIR__ . '/finder/my-category.php' );
    $finder_categories_manager->register( new \My_Finder_Category() );
}
add_action( 'elementor/finder/register', 'register_finder_category' );

Default Categories

IDDescription
createCreate posts, pages, templates
editEdit posts, pages, templates
generalGeneral Elementor links
settingsElementor settings pages
toolsElementor tools
siteSite links

Add Items to Existing Category

function add_finder_items( array $categories ) {
    $categories['create']['items']['theme-template'] = [
        'title' => esc_html__( 'Add New Theme Template', 'textdomain' ),
        'icon' => 'plus-circle-o',
        'url' => admin_url( 'edit.php?post_type=elementor_library#add_new' ),
        'keywords' => [ 'template', 'theme', 'new', 'create' ],
    ];
    return $categories;
}
add_filter( 'elementor/finder/categories', 'add_finder_items' );

Remove Categories / Items

// Remove entire category
function remove_finder_category( array $categories ) {
    unset( $categories['edit'] );
    return $categories;
}
add_filter( 'elementor/finder/categories', 'remove_finder_category' );

// Remove specific item
function remove_finder_item( array $categories ) {
    unset( $categories['create']['items']['post'] );
    return $categories;
}
add_filter( 'elementor/finder/categories', 'remove_finder_item' );

Simple Example: Social Media Links

See resources/context-menu-finder.md for a complete Finder category implementation.

5. Context Menu (JavaScript)

Context Menu Types

  1. Element - right-click on Section, Column, or Widget
  2. Empty Column - right-click on empty column area
  3. Add New - right-click on add new section/template area

Available Groups by Element Type

GroupSectionColumnWidget
generalYesYesYes
addNewNoYesNo
clipboardYesYesYes
saveYesNoYes
toolsYesYesYes
deleteYesYesYes

PHP: Enqueue Editor Script

function my_context_menu_scripts() {
    wp_enqueue_script(
        'my-context-menus',
        plugins_url( 'assets/js/context-menus.js', __FILE__ ),
        [],
        '1.0.0',
        false
    );
}
add_action( 'elementor/editor/after_enqueue_scripts', 'my_context_menu_scripts' );

JS: Add New Group with Actions

window.addEventListener( 'elementor/init', () => {
    elementor.hooks.addFilter( 'elements/context-menu/groups', ( customGroups, elementType ) => {
        const newGroup = {
            name: 'my-custom-group',
            actions: [
                {
                    name: 'my-action-1',
                    icon: 'eicon-alert',
                    title: 'My Action',
                    isEnabled: () => true,
                    callback: () => console.log( 'Action triggered' ),
                },
            ],
        };
        if ( 'widget' === elementType ) {
            customGroups.push( newGroup );
        }
        return customGroups;
    } );
} );

JS: Modify Groups and Actions

// Add action to existing group
customGroups.forEach( ( group ) => {
    if ( 'general' === group.name ) { group.actions.push( newAction ); }
} );

// Remove group
const idx = customGroups.findIndex( ( g ) => 'my-group' === g.name );
if ( idx > -1 ) { customGroups.splice( idx, 1 ); }

// Remove action from group
group.actions.splice( group.actions.findIndex( ( a ) => 'my-action' === a.name ), 1 );

// Update action property
group.actions.forEach( ( a ) => { if ( 'my-action' === a.name ) { a.icon = 'eicon-code'; } } );

6. Hello Elementor Theme

All Theme Hooks

Hook (Filter)DefaultPurpose
hello_elementor_post_type_supporttrueRegister post type support
hello_elementor_add_theme_supporttrueRegister theme features (title-tag, thumbnails, etc.)
hello_elementor_register_menustrueRegister navigation menus
hello_elementor_add_woocommerce_supporttrueRegister WooCommerce support
hello_elementor_register_elementor_locationstrueRegister Elementor theme locations
hello_elementor_enqueue_styletrueLoad style.min.css
hello_elementor_enqueue_theme_styletrueLoad theme.min.css
hello_elementor_content_width800Content width in pixels
hello_elementor_page_titletrueShow page title
hello_elementor_viewport_contentwidth=device-width, initial-scale=1Viewport meta tag
hello_elementor_enable_skip_linktrueEnable accessibility skip link
hello_elementor_skip_link_url#contentSkip link target URL

Disable a Feature

add_filter( 'hello_elementor_register_menus', '__return_false' );
add_filter( 'hello_elementor_enqueue_theme_style', '__return_false' );
add_filter( 'hello_elementor_page_title', '__return_false' );

Custom Content Width

function custom_content_width() {
    return 1024;
}
add_filter( 'hello_elementor_content_width', 'custom_content_width' );

Other Customizations

// Custom viewport
add_filter( 'hello_elementor_viewport_content', fn() => 'width=100vw, height=100vh, user-scalable=no' );

// Custom skip link by page type
add_filter( 'hello_elementor_skip_link_url', function() {
    if ( is_404() ) { return '#404-content'; }
    return is_page() ? '#page-content' : '#main-content';
} );

// Override navigation menus
add_filter( 'hello_elementor_register_menus', '__return_false' );
register_nav_menus( [ 'my-header-menu' => esc_html__( 'Header Menu', 'textdomain' ) ] );

// Remove description meta tag
add_action( 'after_setup_theme', function() {
    remove_action( 'wp_head', 'hello_elementor_add_description_meta_tag' );
} );

7. Hosting Cache Integration

Purge Everything

Action hook with no parameters. Clears all page cache.

do_action( 'elementor/hosting/page_cache/purge_everything' );

Allow Page Cache Filter

function custom_page_cache( $allow ) {
    if ( ! $allow ) { return $allow; }
    return is_my_special_page();
}
add_filter( 'elementor/hosting/page_cache/allow_page_cache', 'custom_page_cache', 20 );

Changed URLs Filter

Hook: elementor/hosting/page_cache/{$content_type}_changed_urls

$content_type values: post, comment, woocommerce_product, etc.

Parameters: $urls (array), $content_id (int).

function clear_cache_on_product_update( $urls, $product_id ) {
    if ( ! is_array( $urls ) || empty( $urls ) ) { $urls = []; }
    $urls[] = site_url( '/my-path' );
    return $urls;
}
add_filter(
    'elementor/hosting/page_cache/woocommerce_product_changed_urls',
    'clear_cache_on_product_update', 10, 2
);

8. Common Mistakes

MistakeConsequenceFix
Not checking function_exists('elementor_theme_do_location')Fatal error if Elementor not activeAlways wrap in function_exists check with fallback
Using get_type() value that does not match parent condition nameSub-condition not displayedget_type() must return the parent condition's get_name() value
Returning wrong category constant in dynamic tagsTag not shown for matching controlsUse \Elementor\Modules\DynamicTags\Module::*_CATEGORY constants
Missing echo in dynamic tag render()Empty outputrender() must echo, not return
Not escaping dynamic tag outputXSS vulnerabilityUse wp_kses_post(), esc_html(), or esc_url()
Forgetting elementor/init listener in context menu JSFilter runs before Elementor readyWrap in window.addEventListener('elementor/init',...)
Using elementor/editor/after_enqueue_scripts for frontend JSScript only loads in editorUse wp_enqueue_scripts for frontend, editor hook for editor-only
Not validating $allow parameter in cache filterOverrides other filtersCheck if (! $allow) {return $allow;} first
Registering location without Elementor Pro activeTheme Builder requires ProCheck if Elementor Pro is active before registering conditions
Calling register_all_core_location() and individual locationsDuplicate registrationsUse one or the other, not both

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.62%
按下载量换算76

Claude

29.3%
按下载量换算58

Cursor

17.26%
按下载量换算34

Gemini CLI

10.18%
按下载量换算20

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

权限需确认

当前来源未能明确判断权限范围,默认进入异常复核队列。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills