Support Forum
Hi,
I show all videos (=cpt), the view type = shortcode.
I have custom fields: keywords, length (both fieldtype text), trailer (url) and platform (checkbox list).
All custom fields are shown correctly, except the platform, that's not shown.
This is the code:
{% set args = { post_type: 'video', numberposts: '-1', order: 'asc', orderby: 'title'} %}
{% set posts = mb.get_posts( args ) %}
<div class="sub_container">
{% for post in posts %}
<div class="sub_item">
{% set post_link = mb.get_permalink( post.ID ) %}
<h3><a href="{{ post_link }} ">{{ post.post_title }} </a> </h3>
[su_row][su_column size="1/2" center="no" class=""]<a href="{{ post_link }}">{{ mb.get_the_post_thumbnail( post.ID, 'thumbnail' ) }} </a>[/su_column]
[su_column size="1/2" center="no" class=""]<strong>Keywords:</strong><br />{{ post.keywords }}<br />
<strong>Time: </strong>{{ post.length }} - <a href="{{ post.trailer}} ">[icon name="video" style="solid" ]</a>
{% for item in post.platform %}
{{ item.label }}
{% endfor %}
[/su_column][/su_row]
</div>
{% endfor %}
</div>
What am I doing wrong?
Hi,
It's so weird, I do not see any issue when using this code to output the checkbox list value/label
{% for item in post.checkbox_list_id%}
{{ item.label }} - {{ item.value}}
{% endfor %}
Can you please share the code that creates the checkbox list field on your site?
Hi Long,
The code I gave you before is for listing all video's. That works through view type = shortcode.
In another view the details of a video is shown (view type = singular), there the code works nicely.
Back to your question, here is the code for the checkbox list field.
<?php
add_filter( 'rwmb_meta_boxes', 'your_prefix_function_name' );
function your_prefix_function_name( $meta_boxes ) {
$prefix = '';
$meta_boxes[] = [
'title' => __( 'VideoDetails', 'your-text-domain' ),
'id' => 'videodetails',
'post_types' => ['video'],
'fields' => [
[
'name' => __( 'Keywords', 'your-text-domain' ),
'id' => $prefix . 'keywords',
'type' => 'text',
],
[
'name' => __( 'Length', 'your-text-domain' ),
'id' => $prefix . 'length',
'type' => 'text',
],
[
'name' => __( 'Trailer', 'your-text-domain' ),
'id' => $prefix . 'trailer',
'type' => 'url',
],
[
'name' => __( 'Platform', 'your-text-domain' ),
'id' => $prefix . 'platform',
'type' => 'checkbox_list',
'options' => [
'F' => __( 'Fansly', 'your-text-domain' ),
'LF' => __( 'LoyalFans', 'your-text-domain' ),
'OF' => __( 'OnlyFans', 'your-text-domain' ),
],
'std' => true,
'inline' => true,
'select_all_none' => true,
],
],
];
return $meta_boxes;
}
Hi,
Please share your site credentials via this contact form https://metabox.io/contact/
and some screenshots/details of the issue. I will help you to check the issue.
I have sent the info you requested. Thanks for your help.