Skip to main content

Elements Overview

warning

Elements can inject markup or code site-wide. Use narrow display rules and test on staging first, especially when inserting scripts or custom PHP.

What Elements Are (and What They Are Not)

Element typeWhat it doesBest for
HookInjects content into a hook locationBanners, notices, tracking code, small sections
BlockRenders block-based content via a hook/display rulesHeroes, CTAs, reusable sections
LayoutChanges layout settings conditionallyFull-width pages, no header/footer on specific URLs
HeaderBuilds a custom header/hero region conditionallyLanding-page headers, archive headers

Key Concepts

  • Elements give you a UI-driven, update-safe way to customize without editing the parent theme.
  • Display rules let you target changes precisely (one page, one post type, one category).
  • You can often avoid long-lived template overrides by using Elements + hooks.

How It Works

Elements attach behavior to the same GeneratePress hook system you already explored. The difference is that GP Premium stores the element configuration and renders it conditionally.

flowchart TD
GP[GeneratePress hook points] --> RUN["do_action('generate_*')"]
RUN --> GPP[GP Premium Elements]
GPP --> RULES[Display rules]
RULES --> OUT[Element output]
CHILD[Child theme hooks] --> RUN

Best Practices

PracticeWhy
Name elements consistentlyEasier audits (e.g., Header: Blog, Hook: Top notice)
Keep one purpose per elementEasier debugging and rollback
Keep display rules narrowPrevents accidental site-wide changes
Avoid long inline scriptsProtects performance and maintainability
Document why an element existsPrevents "mystery" markup later
Plan a rollback pathDisabling an element should be your first response

Troubleshooting

SymptomCauseFix
Element not showingDisplay rules too strictWiden rules temporarily and re-test
Element shows everywhereDisplay rules too broadRestrict to specific pages/post types
Changes not visibleCachePurge LSCache and test logged-out
Layout breaksElement outputs unexpected wrappersSimplify markup and add targeted CSS
Element behaves differently for adminsCache varies by roleTest logged-out and review cache configuration

Self-Check

  1. Name three problems Elements solve without touching theme files.
  2. For a hypothetical CTA, choose the Element type (Hook vs Block vs Layout) and explain why.
  3. Describe a safe rollout plan: start narrow, test logged-out, and keep a rollback path.

Quick Reference

If you need to...Start with...
Inject markup in a specific locationHook Element + narrow rules
Build a reusable hero/CTA sectionBlock Element
Change layout for a page typeLayout Element
Replace a header for a landing pageHeader Element

What's Next