On all my page templates I have a checkbox which says whether to show a call to action before the footer (A strip with a button which links to the contact page). This is what's in the footer:
<?php if (rwmb_meta("truvision_footer_show_cta")): ?>
<div class="strip strip--large-top-padding strip--large-bottom-padding bg--pattern">
<div class="container">
<div class="row">
<div class="col-xs-12 text--center"><a href="<?php echo get_permalink(rwmb_meta('truvision_footer_cta_link')); ?>" class="button button--secondary"><?php echo rwmb_meta('truvision_footer_cta_text'); ?></a>
</div>
</div>
</div>
</div>
<?php endif; ?>
It works fine, apart from when a certain shortcode is present. If this shortcode is rendered on a page all the rwmb_meta() functions return values as if they hadn't been set. This is the shortcode:
function services() {
$services = new WP_Query(array('post_type' => 'service-post', 'order' => 'ASC'));
if ( $services->have_posts() ) :
$content = '<div class="services js-services">';
$services_id = 0;
while ( $services->have_posts() ) : $services->the_post();
if ($services_id %4 === 0 || $services_id === 0) {
$content .= "<div class='row'>";
}
$content .= '<div class="col-xs-12 col-sm-3"><div class="bolt-on"><img src="' . wp_get_attachment_image_src( get_post_thumbnail_id(), 'full')[0] . '" alt="Realistic stills gallery" class="bolt-on_icon"><h3 class="bolt-on_title js-bolt-on_title">' . get_the_title() . '</h3>' . get_the_content() . '</div></div>';
$services_id++;
if ($services_id %4 === 0 && $services_id != 0) {
$content .= "</div>";
}
endwhile;
$content .= '</div>';
endif;
return $content;
}
add_shortcode('services', 'services');
Any idea what's happening??