Post Selector Control
Select posts from your WordPress site. Pro feature.
Options
Section titled “Options”| Option | Type | Default | Description |
|---|---|---|---|
label | string | - | Field label |
control | string | post-selector | Control type |
postType | string | post | Post type to select from |
postStatus | string | publish | Post status filter |
Post Type Options
Section titled “Post Type Options”| Post Type | Description |
|---|---|
post | Blog posts |
page | Pages |
product | WooCommerce products |
| Custom | Any registered post type |
Example
Section titled “Example”{ "attributes": { "featuredPost": { "type": "number", "default": 0, "wbs": { "label": "Featured Post", "control": "post-selector", "postType": "post", "postStatus": "publish" } } }}Template Usage
Section titled “Template Usage”{% set post = Post(attributes.featuredPost) %}{% if post %} <article class="featured-post"> <h2>{{ post.title }}</h2> <div class="post-excerpt">{{ post.excerpt }}</div> <a href="{{ post.link }}">Read More</a> </article>{% endif %}Use Case
Section titled “Use Case”Use Post Selector for featured posts, related content, or any dynamic content that references other posts.
Pro Feature
Section titled “Pro Feature”The Post Selector control is only available in WPBits Block Studio Pro. See Pro Features for more information.