Notifications
Clear all

Check for is_first_post when triggering custom shortcode from within post

1 Posts
1 Users
0 Reactions
52 Views
Posts: 42
Topic starter
(@golabs)
Trusted Member
Joined: 4 years ago

I created a shortcode that must only be usable from within the first post (is_first_post = 1).

The plugin is already fully working, I just need to add the check if it's being called from within the first post.

How can I do that?

I already had a look at:

$WPF     = WPF();
$WPF_posts = $WPF->current_object['posts'];

But that lists ALL the posts (so including replies) on the page/of the topic... but it doesn't tell me from within which post I called the information.

Anyone an idea how to get hold of just the details of the post from which the shortcode is triggered?