# Log In Prompt in the Middle of Posts

> Shows a small "Log in or create an account" box halfway through articles for visitors who are not logged in.

- Type: Universal
- Runs: Content half
- Category: [Login](https://wpide.com/library/category/login/)
- Tags: login, members, call-to-action
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/login-prompt-mid-article/

## Code

```php
<?php if ( ! is_user_logged_in() ) : ?>
<aside class="wpide-login-prompt" style="margin:2em 0;padding:1em 1.25em;border-left:4px solid currentColor;background:rgba(127,127,127,.08)">
    <p style="margin:0">
        <strong>Join the conversation.</strong>
        <a href="<?php echo esc_url( wp_login_url( get_permalink() ) ); ?>">Log in</a>
        <?php if ( get_option( 'users_can_register' ) ) : ?>
            or <a href="<?php echo esc_url( wp_registration_url() ); ?>">create a free account</a>
        <?php endif; ?>
        to comment and get updates.
    </p>
</aside>
<?php endif; ?>
```

## Notes

The "create an account" link only appears when "Anyone can register" is enabled.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Log In Prompt in the Middle of Posts" in its snippet library and add it in one click; or create a new Universal snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
