# Insert signup form in post

**URL:** <https://forum.ghost.org/t/insert-signup-form-in-post/16376>\
**Category:** Memberships & subscriptions\
**Created:** [August 9, 2020, 3:30pm UTC](https://forum.ghost.org/t/insert-signup-form-in-post/16376 "2020-08-09T15:30:05Z")\
**Posts on this page:** 1\
**Showing post:** 32

<div class="post-metadata">

**Author:** ![Stromfeldt](https://sea1.discourse-cdn.com/flex015/user_avatar/forum.ghost.org/stromfeldt/32/13572_2.png) [@Stromfeldt](https://forum.ghost.org/u/Stromfeldt)\
**Post date:** [February 6, 2023, 2:39am UTC](https://forum.ghost.org/t/insert-signup-form-in-post/16376/32 "2023-02-06T02:39:10Z")

</div>

Has anybody actually gotten this working? Cause I’ve recommended it to many people who’ve asked about doing such a thing, with the caveat that I haven’t actually tried it out myself. Well, I just tried it out for a theme I’m finishing off, and it doesn’t actually work. I don’t recall where I got the code from, but nonetheless I (who doesn’t know any JS) did a bit of trial and error and actually got it working.

This the JS you’ll need, and replace the `<div></div>` with the code for the signup form or signup button or whatever else it is you’d like to insert.

```auto
<script>
    document.querySelectorAll(".non-member-insertion .subscribe-form-insertion").forEach((elem) => {
        elem.innerHTML = "<div></div>";
    });
</script>

```

Your snippet will look like such:

```auto
<div class="subscribe-form-insertion"></div>

```

And you’ll have to insert `{{#if @member}} member-insertion{{else}} non-member-insertion{{/if}}` around the content of the post/page, so something like this:

```auto
<div class='c-content{{#if @member}} member-insertion{{else}} non-member-insertion{{/if}}'>

```

Done.

---

_[View the full topic](https://forum.ghost.org/t/insert-signup-form-in-post/16376)._
