Overview

What It Is and Where It Lives

Card is the partial that lives inside the Cards Row block. When you're editing a Cards Row, you add individual Card partials as its children — each one becomes a single card in the row. The block inserter inside a Cards Row offers Card as the available child block.

Why You'd Reach for It

The Cards Row block defines the overall row layout, column count, shared display options, and styling — but it has no content of its own. Each Card partial is where the actual content lives: the specific post being featured, the image or icon, the title, body copy, and any call-to-action link. Without Card children, a Cards Row renders nothing meaningful.

Key Capabilities

  • Post-sourced or custom content — a card can pull data from an existing post (of any registered post type) or be authored entirely by hand with custom title, body, and media
  • Flexible media slot — when in custom mode, the card accepts either a WordPress media library image or a registered SVG, selectable per card
  • Custom title and body text — freeform textarea fields for card heading and body copy (body field appears when enabled on the parent row)
  • CTA text override — when the parent row enables a CTA button, each card can supply its own button label text
  • Whole-card link target — a checkbox makes the entire card clickable as a single link, without requiring a visible CTA button
  • Internal or external link destination — the card link can point to any internal post/page (chosen by post type then individual post) or to an arbitrary external URL
  • External URL support — a dedicated field and checkbox handle links that open to outside domains

DOM Structure

<div class="card-source" style="display:none">{cardSource}</div>

<!-- when Card Source is a post type (not "custom") -->
<!-- one SelectControl rendered per matching post type; selects the linked post by ID -->
<fieldset>
  <input type="hidden" class="card-source" value="{cardSource}" />
  <!-- SelectControl: post picker for the matched post type -->
  <select class="card-post-id">
    <!-- one <option> per published post of the matched type -->
    <option value="{postId}" selected>{postTitle}</option>
  </select>
</fieldset>

<!-- when Card Source is "custom" -->
<div>
  <input type="hidden" class="card-source" value="custom" />

  <fieldset>
    <!-- when Media Type is "svg" -->
    <select class="card-svg">
      <!-- one <option> per available SVG -->
      <option value="{svgId}" selected>{svgLabel}</option>
    </select>

    <!-- when Media Type is "img" -->
    <!-- See DOM Notes: MediaUpload image picker -->
    <div class="block-display-image">
      <!-- when an image has been selected -->
      <div class="block-display-image-inner" style="background-image: url({imageUrl})">
        <a>
          <span class="button is-small">Remove</span>
        </a>
      </div>
    </div>
    <!-- when no image is selected -->
    <div>
      <label>Image</label>
      <a class="button">+ Add Media</a>
    </div>
  </fieldset>

  <fieldset>
    <!-- TextareaControl: Card Title -->
    <textarea class="card-title">{title}</textarea>
  </fieldset>

  <!-- when parent Cards Row has "Display Body" enabled -->
  <fieldset>
    <!-- TextareaControl: Card Body -->
    <textarea class="card-body">{body}</textarea>
  </fieldset>

  <!-- when parent Cards Row has "Display CTA" enabled -->
  <!-- TextControl: CTA Text -->
  <input type="text" class="cta-text" value="{ctaText}" placeholder="Enter text to override the default button text." />

  <!-- when parent Cards Row does NOT have "Display CTA" enabled -->
  <fieldset>
    <!-- CheckboxControl: Link the card -->
    <input type="checkbox" class="link-card" checked="{linkCard}" />
    <label>Link the card</label>
  </fieldset>

  <!-- when "Link the card" is checked OR parent Cards Row has "Display CTA" enabled -->
  <fieldset>
    <!-- CheckboxControl: Link is external URL -->
    <input type="checkbox" class="href-is-external" checked="{hrefIsExternal}" />
    <label>Link is external URL</label>

    <!-- when "Link is external URL" is checked -->
    <input type="text" class="external-url" value="{externalUrl}" placeholder="Enter the full URL for an external resource. Including https://" />

    <!-- when "Link is external URL" is NOT checked -->
    <div>
      <!-- SelectControl: post type picker for internal link -->
      <select class="link-post-type">
        <!-- one <option> per available post type -->
        <option value="{linkPostType}" selected>{postTypeLabel}</option>
      </select>

      <!-- when a post type has been selected; one SelectControl per matching post type -->
      <select class="link-post-id">
        <!-- one <option> per published post of the selected type -->
        <option value="{linkPostId}" selected>{postTitle}</option>
      </select>
    </div>
  </fieldset>

</div>

DOM Notes

Dynamic Behavior

Card Source Branch (Post-Linked vs. Custom)

The editor canvas renders one of two mutually exclusive authoring interfaces depending on the Card Source mode inherited from the parent Cards Row block via attributes.source. When the source matches a registered post type key (e.g. "page", "post", a custom post type), the card editor shows only a single post-selection dropdown populated with published posts of that type — the editor picks which post this card represents, and the block outputs a JSON payload containing just the selected post ID for the front-end to hydrate. When the source is set to "custom", the full manual-entry interface appears instead, with fields for media, title, body, CTA, and link controls. These two modes are mutually exclusive and cannot be simultaneously visible; switching the source on the parent Cards Row block toggles which interface is shown for every child card.

Post Options Loading State (Post-Linked Mode)

When the card is in post-linked mode, each registered post type's dropdown is populated via a WordPress data store query (getEntityRecords) that runs asynchronously on editor load. While data is still being fetched, the dropdown shows a single disabled placeholder option labeled "Loading…". Once the query resolves, that placeholder is replaced with a properly labeled default prompt ("Select a [Post Type Name]") followed by all published posts sorted alphabetically by title. HTML entities in post titles (e.g. &amp;, &#8217;) are decoded to plain text before display. Media attachments follow the same pattern but query the media library and display filenames instead of titles.

Media Type Sub-Interface (Custom Mode)

Within the custom-source interface, the visible media input changes based on the Media Type value set on the parent Cards Row block (attributes.mediaType). Two states exist:

  • SVG (mediaType === "svg"): a dropdown labeled "SVG" appears, populated from the site's registered SVG options (fc_data.svg_options). The editor selects an SVG by ID.
  • Image (mediaType === "img"): a WordPress MediaUpload interface appears. If no image has been selected, a button labeled "+ Add Media" is shown. Once an image is selected, a 150 px-tall thumbnail preview is shown with a "Remove" button overlaid; clicking Remove clears the image selection and returns to the add-media state. No media input is rendered for any other mediaType value.

Link / CTA Controls (Custom Mode)

The link and CTA authoring controls render conditionally based on two interacting states — whether the parent Cards Row has Display CTA enabled (attributes.displayCTA) and whether the editor has checked Link the card (linkCard):

  • If displayCTA is off: a "Link the card" checkbox is visible. If unchecked, no further link controls appear.
  • If displayCTA is on: the "Link the card" checkbox is hidden, and a CTA Text override field appears instead. The link destination controls (described below) are shown regardless of the linkCard checkbox value because displayCTA being on implies a link is always present.
  • Whenever linkCard is checked or displayCTA is on, the link destination section appears:
    • A "Link is external URL" checkbox is shown.
    • If checked: a free-text URL input appears for entering a full external URL.
    • If unchecked: an internal post picker appears — first a post type selector dropdown (populated from all available post types, excluding "custom" and "child-pages"), then, once a post type is chosen, a second post dropdown filtered to that type for selecting the specific destination post.

Technical Documentation

Parent Block

Card lives inside the Cards Row block. To add a Card, open a Cards Row in the editor and use the block inserter to add Card children. All Card settings are configured directly on the card's canvas (the block's edit view rendered inline in the editor), not in a sidebar inspector panel — this block has no <InspectorControls>.

Canvas Controls

All controls for the Card block are rendered directly on the editor canvas. What appears on the canvas depends on two values set by the parent Cards Row block: the source (which determines whether the card pulls from a post type or uses manually entered content) and the media type (which determines whether an image or SVG is shown). These values are inherited from the parent and cannot be changed on the individual card itself.

Post Selection Dropdown

  • Attribute: postId
  • Type: single-select dropdown
  • Default: "0" (placeholder/disabled prompt)

What it controls — When the parent Cards Row is configured to source cards from a specific post type (e.g. Pages, Posts, or any registered custom post type), this dropdown appears on each Card's canvas and lets the editor choose which individual post this card represents. The selected post's data (title, image, etc.) is then used by the front-end template to render the card.

Options — Populated dynamically from the WordPress post library for the post type selected on the parent block. Options are listed alphabetically by title. A disabled placeholder prompt ("Select a [Post Type Name]") appears as the first option until a selection is made.

Conditional Logic — Appears only when the parent Cards Row's source is set to a specific registered post type (not "Custom"). One dropdown per card; its label matches the post type name (e.g. "Page", "Post").

Notes — Posts are fetched with status: publish or private and ordered A–Z by title. HTML entities in post titles (e.g. &amp;) are decoded before display. Media/attachment post types use filename as the label instead of title.

SVG

  • Attribute: svg
  • Type: single-select dropdown
  • Default: none

What it controls — Selects which SVG graphic is displayed in the card's media area on the front end.

Options — Populated from the site's registered SVG library (fc_data.svg_options). The available SVGs are defined at the theme or site configuration level.

Conditional Logic — Appears only when the parent Cards Row's source is set to "Custom" and its media type is set to "SVG".

Image

  • Attribute: image
  • Type: media picker (WordPress Media Library)
  • Default: none

What it controls — Sets the image displayed in the card's media area on the front end.

Options — Any image available in the WordPress Media Library. Single selection only. Once an image is selected, a 150 px tall thumbnail preview appears on the canvas with a Remove button to clear it. If no image is set, an + Add Media button opens the media library.

Conditional Logic — Appears only when the parent Cards Row's source is set to "Custom" and its media type is set to "Image" (internally "img").

Card Title

  • Attribute: title
  • Type: multi-line text area
  • Default: none

What it controls — Sets the title text displayed on the front-end card. Supports multi-line entry.

Conditional Logic — Appears only when the parent Cards Row's source is set to "Custom".

Card Body

  • Attribute: body
  • Type: multi-line text area
  • Default: none

What it controls — Sets the descriptive body text displayed beneath the title on the front-end card.

Conditional Logic — Appears only when the parent Cards Row's source is set to "Custom" and the parent Cards Row has Display Body enabled.

CTA Text

  • Attribute: ctaText
  • Type: single-line text field
  • Default: none (empty overrides the default button label)

What it controls — Overrides the default call-to-action button label on the front-end card. Leave blank to use the default button text defined by the card template.

Conditional Logic — Appears only when the parent Cards Row's source is set to "Custom" and the parent has Display CTA enabled.

Link the card

  • Attribute: linkCard
  • Type: checkbox
  • Default: false

What it controls — When checked, the entire card becomes a clickable link on the front end (rather than only a CTA button).

Conditional Logic — Appears only when the parent Cards Row's source is set to "Custom" and the parent does not have Display CTA enabled. When Display CTA is active, the CTA button handles linking and this control is hidden.

Link is external URL

  • Attribute: hrefIsExternal
  • Type: checkbox
  • Default: false (unchecked)

What it controls — Toggles whether the card's link target is an external URL or an internal page. When checked, a free-text URL field appears. When unchecked, internal post-picker dropdowns appear instead.

Conditional Logic — Appears only when Link the card is checked OR the parent has Display CTA enabled, and the parent's source is "Custom".

External URL field (child of "Link is external URL")

  • Attribute: externalUrl
  • Type: single-line text field
  • Default: none

What it controls — Sets the full external URL the card or CTA button links to on the front end (e.g. https://example.com).

Conditional Logic — Appears only when Link is external URL is checked.

Notes — The placeholder text instructs editors to include the full URL with https://.

Post Type selector (for internal link)

  • Attribute: linkPostType
  • Type: single-select dropdown
  • Default: none (disabled placeholder prompt)

What it controls — Selects which post type to browse when choosing an internal link destination. Once a type is selected, a second dropdown appears listing individual posts of that type.

Options — All registered post types available in the site's configuration (fc_data.post_type_options), excluding "Custom" and "child-pages". A disabled "Select a Post Type" prompt appears first.

Conditional Logic — Appears only when Link is external URL is unchecked and the card/CTA linking is active.

Internal post selector (for internal link)

  • Attribute: linkPostId
  • Type: single-select dropdown
  • Default: 0

What it controls — Selects the specific internal page or post the card links to. The chosen post's URL is used as the card's or CTA button's href on the front end.

Options — Populated dynamically with all published/private posts of the type chosen in the Post Type selector above, ordered A–Z by title.

Conditional Logic — Appears only after a Post Type has been selected in the internal link post-type dropdown.

Cross-Block Relationships

The Card block is tightly coupled to its parent Cards Row block. Several card-level controls only appear or take effect when specific settings are configured on the parent:

  • The parent's Source setting determines whether each card shows a post-picker dropdown (post-type mode) or the full suite of custom content fields (Custom mode).
  • The parent's Media Type setting (Image vs. SVG) determines which media control — image picker or SVG dropdown — appears on each custom card.
  • The parent's Display Body toggle controls whether the Card Body textarea is shown on each child card.
  • The parent's Display CTA toggle controls whether the CTA Text field or the Link the card checkbox is shown — only one of these two linking patterns is active at a time.

Theme-Level Integrations

  • SVG options — The SVG dropdown is populated from fc_data.svg_options, a site-level registry of available SVG assets defined at the theme or build-configuration level. Editors can only select SVGs that have been registered there.
  • Post type options — Both the card source post-picker and the internal link post-type selector are populated from fc_data.post_type_options, which reflects the post types registered and exposed for this site.