# WordPress

WordPress can host Plandalf through Custom HTML blocks, theme templates, or plugin-managed script injection. Use the simplest block first, then move the script into a theme or plugin once the page works.

> [!NOTE]
> **WordPress is the page shell**
> Let WordPress handle content, memberships, and templates. Let Plandalf handle the offer, checkout, promo pricing, invoices, and post-purchase automation.

## The path

1.  Choose where the SDK loads

    Put the script in a Custom HTML block for a quick test, or enqueue it from the theme/plugin for a production-wide install.

2.  Add one checkout action

    Use a Custom HTML block or template markup with `data-plandalf-present`.

3.  Identify logged-in users when needed

    Membership and LMS sites should generate identity server-side and call `identify()` on checkout pages.

4.  Verify with the published page

    Test the real page output because builders, cache plugins, and optimizers can move or delay scripts.

## Quick block install

<scalar-tabs default="Button">
<scalar-tab title="Button">

```html
<script src="https://acme.plandalf.dev/js/plandalf-sdk.js" async></script>

<button data-plandalf-present="pro-plan">
  Buy Pro
</button>
```

</scalar-tab>
<scalar-tab title="Inline checkout">

```html
<div data-plandalf-mount="pro-plan" style="min-height: 480px"></div>
```

</scalar-tab>
<scalar-tab title="Countdown">

```html
<div data-plandalf-promo="early-bird"></div>
```

</scalar-tab>
</scalar-tabs>

## Logged-in users

For membership, LMS, or account-based sites, generate a signed identity token server-side and identify the visitor before checkout. Put this script on the page after the SDK loads. The non-async script tag below makes that order explicit.

```html
<script src="https://acme.plandalf.dev/js/plandalf-sdk.js"></script>
<script>
  plandalf.ready(() => {
    plandalf.identify("SIGNED_JWT_FROM_WORDPRESS");
  });
</script>
```

WordPress setup choices

- `Custom HTML block` (page-level): Fastest way to test one page or one campaign.

- `Theme template` (template-level): Useful when every product, post, or landing page should expose a buying action.

- `Plugin/script enqueue` (site-level): Best for a managed production install, especially when caching or optimization plugins are active.

## Related docs

- [Identify customers](https://plandalf.com/docs/sdk/identify) — Pass logged-in WordPress users into checkout safely.

- [Gates](https://plandalf.com/docs/sdk/gate) — Use purchase or membership context to control what visitors can see.

- [Add to your site](https://plandalf.com/docs/product-guides/checkouts/add-to-site) — Pick hosted checkout, button, inline checkout, or direct link.

Source: https://plandalf.com/docs/product-guides/platforms/wordpress
