Support Forum
Support › MB Views › Cloneable Fields in View (using shortcode) won't show in Beaver Themer layoutResolved
I have created a view that should display the contents of a cloneable fields. The view works on the "single" beaver themer layout. When I insert in to Post Module post layout, the field contents does not show. There are no debug errors or console errors.
Here's the code in my view:
{% for clone in post.member_group_contacts %}
<div class="member-contact-clones">
<div class="contact-name">{{ clone.member_contact_name }}</div>
<div class="contact-title">{{ clone.member_contact_title }}</div>
<div class="contact-email">{{ clone.member_contact_email }}</div>
<div class="contact-phone">{{ clone.member_contact_phone }}</div>
</div>
{% endfor %}
Thank you for your help.
Hi Chris,
That means Meta Box cannot get the ID of each post in the module Posts of Beaver Builder to show the field value of each post. You can try to contact Beaver support to ask for getting post ID in the custom post layout. Screenshot https://share.getcloudapp.com/kpuDv7Wb
Or create your own post list with View and insert the shortcode to the page.
Thank you for your answer. I ended up building a function and shortcode to drop the information into the post module custom layout. I couldn't figure out how to tell the View what the post id was inside the Beaver Themer module. It's works using this function.
function member_contact_info(){
echo '<div class="member-org-title">', get_the_title( $post_id ),'</div>';
$contact_values = rwmb_meta( 'member_group_contacts' );
if ( ! empty( $contact_values ) ) {
foreach ( $contact_values as $contact_value ) {
echo '<div class="member-contact-group">';
echo '<div class="contact-name">', $contact_value['member_contact_name'], '</div>';
echo '<div class="contact-title">', $contact_value['member_contact_title'], '</div>';
echo '<div class="contact-email"><a href="mailto:', $contact_value['member_contact_email'], '">',$contact_value['member_contact_email'], '</a></div>';
echo '<div class="contact-phone">', $contact_value['member_contact_phone'], '</div></div>';
}
}
}
add_shortcode('membercontact', 'member_contact_info');
I cobbled it together using information I found in the Metabox documentation. Thanks again.