GoBuildWP

ThemesPro

GeneratePress MCP: Elements, display conditions and Site Library imports

GeneratePress is a layout shell, and GeneratePress MCP work mirrors that. GoBuildWP reads and patches generate_settings, manages GP Premium Elements and the conditions that decide where each one appears, installs Google fonts into the local Font Library, and can import a Site Library starter site with GP Premium's own backup as the way back. Visual sections in the page body come from GenerateBlocks, which is a separate module.

AI clientyour-site.comVerify site policy

Add a thin announcement bar above the header saying 'Free shipping this week', but only on WooCommerce shop and product pages.

  1. wppilot/generatepress-check-setupRead

    Confirms GP Premium is active with the Elements module on; without it, no element abilities load.

  2. wppilot/generatepress-list-hooksRead

    Returns the hook catalogue grouped by area, the same list the Elements admin uses, so the chosen hook exists.

  3. wppilot/generatepress-create-elementConfirm first

    Creates a hook element on the chosen before-header hook with the banner markup; pass status=draft explicitly because the default is publish. Keep the Element draft until conditions and output are reviewed.

  4. wppilot/generatepress-list-element-conditionsRead

    Supplies the valid rule keys, because a mistyped rule is stored and silently never matches.

  5. wppilot/generatepress-set-element-conditionsConfirm first

    Writes the shop and product display rules on that element, leaving the other condition buckets as they were.

Proposed sequence from source declarations; not a recorded task or proof of client compatibility. Inspect saved state and browser or provider results separately.
Edition
Pro
Abilities
23
Requires
WordPress 6.9+, PHP 8.0+, GeneratePress theme 3.0.0+, GP Premium (premium operations) 2.0.0+

Worked example

A sale banner above the header, only on shop pages

Expected outcome to verify on the installed stack; this sequence has not been recorded as a runtime test.

The bar appears only where the rules match, and removing it is one delete to the trash. Creation and condition changes are both undoable. If the rule keys come from memory rather than the catalogue, the element saves and simply never shows.

Prepare an Element as a draft and review its display conditions before publication. If the installed schema cannot stage those conditions safely, prepare it manually rather than briefly exposing an unconditioned live Element. A Site Library settings-only trial applies settings and then restores them; it is not a visual preview.

  1. generatepress-check-setup

    Confirms GP Premium is active with the Elements module on; without it, no element abilities load.

  2. generatepress-list-hooks

    Returns the hook catalogue grouped by area, the same list the Elements admin uses, so the chosen hook exists.

  3. generatepress-create-element

    Creates a hook element on the chosen before-header hook with the banner markup; pass status=draft explicitly because the default is publish. Keep the Element draft until conditions and output are reviewed.

  4. generatepress-list-element-conditions

    Supplies the valid rule keys, because a mistyped rule is stored and silently never matches.

  5. generatepress-set-element-conditions

    Writes the shop and product display rules on that element, leaving the other condition buckets as they were.

Data model

generate_settings, gp_elements and gp_font

The theme's Customizer values sit in a generate_settings array: container width, sidebar and navigation layout, colours, fonts. Reads go through generate_get_option(), so defaults and the theme's option filter apply, and a defaults ability returns the four default sets that describe the known keys. The writer merges, and a key missing from those defaults is still stored but flagged, which lets child themes and Premium modules add their own keys.

GP Premium Elements are gp_elements posts. Their type decides what they are: a hook with markup injected at a theme action, a block element used as a header, footer or content template, or a layout. Display, exclude and user conditions are post meta in the rule format the Elements metabox writes. The Font Library stores each family as a gp_font post and downloads its files under uploads/generatepress/fonts/, then regenerates one fonts.css. Premium modules turn on through generate_package_ options or constants.

Abilities

GeneratePress abilities by effect

Documented source abilities; live registration can be narrower. Edition and effect labels describe the source catalogue. The installed schema, dependency versions, licence, WordPress capability, safety profile and per-ability policy determine availability; labels alone do not prove confirmation or recovery.

Limits

GeneratePress operations with sharp edges

  • A Site Library import needs confirm, overwrites settings, imports content and can install plugins only when you add that step; GoBuildWP cannot undo it, but generatepress-restore-site replays GP Premium's backup.
  • Restoring content deletes the imported posts and consumes the backup, so a second content restore returns gp_no_backup. Restoring theme options keeps the backup.
  • Fonts are files: adding or deleting one is irreversible in the ledger, and delete wipes the font's folder with no trash.
  • The PHP-execution flag on hook elements is permanently blocked from reads and writes.
  • A hard-deleted element is permanent; the default trash delete can be restored.

Other plugins

GeneratePress with GenerateBlocks

  • The setup check reports GenerateBlocks and its Pro edition. Without GenerateBlocks, its blocks are unavailable. Inspect other registered blocks before composing the page body, or keep this GeneratePress workflow to settings and Elements.
  • Block elements hold Gutenberg markup, so GenerateBlocks sections can live inside a header or content template as well as in pages.

GeneratePress builds that hold up

Hosting a font locally and switching GeneratePress to it

Moving a GeneratePress site off fonts loaded from Google's servers is a three-step job, and the order matters. First check generatepress-list-fonts so the family is not installed twice. Then generatepress-add-font downloads the chosen family and variants into GP Premium's Font Library, writes the files under the uploads folder and regenerates fonts.css; asking for variants written the Google way, such as 400, 700 and 700italic, keeps the download to what the design uses. Calling it again for the same family only tops up missing variants.

Installing a font changes nothing visible on its own. The site switches only when font_body or font_headings in generate_settings points at the font's cssVariable, which list-fonts reports, so the last step is a generatepress-set-settings call with that variable rather than a raw family name. Retiring the old font is the reverse: change the settings first, confirm with generatepress-get-css-output that the typography stream no longer mentions it, and only then delete it. Deletion wipes its folder with no trash, and a setting still pointing at it falls back to a system font without warning.

Giving landing pages their own header with a Block Element

Hook elements inject markup at a theme action; block elements replace whole parts of the layout. The block types GP Premium offers include site-header, site-footer, left and right sidebars, page-hero, content and loop templates, post meta and navigation templates, and a search modal. A campaign landing page that needs a stripped-down header is a site-header block element, created as a draft with its markup, then scoped with generatepress-set-element-conditions to the landing pages only.

Before choosing between a block element and a per-page setting, ask generatepress-get-layout for the post in question. It resolves the sidebar layout, navigation location and footer widget count GeneratePress will actually use after theme settings, per-post overrides and filters, which is often not what the Customizer alone suggests. If the page already hides its header through a per-post setting, a new header element may never show, and the layout read will reveal that before anyone wonders why.

  • Element edits leave conditions alone; conditions change only through set-element-conditions.
  • When changing an element's type or block type, send both together so the combination is validated.
  • Retire elements to the trash first; a forced delete cannot be restored.

Why a GeneratePress change may not show

generatepress-get-css-output returns the CSS the theme builds from its settings in separate streams for base colours and containers, typography, spacing and the advanced extras. When a colour or spacing change seems to have done nothing, the stream shows whether the rule changed. If it did, the cause is downstream: a page cache, a CDN, or a GenerateBlocks style on the page that is more specific than the theme's rule.

Questions

GeneratePress questions

Can an AI import a GeneratePress Site Library site safely?

A theme-options-only trial applies settings to existing content, then restores them. It is not a preview. Verify GP Premium’s restoration behavior on staging before a fuller import, and keep an independent backup.

Why is my new GeneratePress font not used?

Installing it only adds it to the Font Library. The font_body or font_headings setting must reference the CSS variable that list-fonts reports for it.

Does it work without GP Premium?

Settings, defaults, layout resolution and CSS output work on the free theme. Elements, the Site Library and the Font Library need the matching Premium modules.

Where these facts come from

GoBuildWP behaviour is taken from the plugin source and the ability reference; third-party details from the vendor documentation below, checked by the GoBuildWP team.

GeneratePress is a separate product; no partnership or endorsement is implied.

Try it on GeneratePress in Read Only first