Support Forum
Support › MB Custom Post Type › ✅Display CPT in page › Reply To: Display CPT in page
I put all the code in a function outside the main function, then call it, yet nothing happens.
// Sub function
function pt() {
$table = isset( $pricing['pricing_table_id'] ) ? $pricing['pricing_table_id'] : '';
if ( $table ) {
$plans = rwmb_meta( 'plan', '', $table );
if ( ! empty( $plans ) ) {
foreach ($plans as $plan) {
$name = isset( $plan['plan_name'] ) ? $plan['plan_name'] : '';
echo $name;
}
}
}
}
//Main function
function page_section() {
$sections = rwmb_meta( 'section' );
if( ! empty( $sections ) ) {
foreach ( $sections as $section ) {
if($section == 'pricing') { pt() }
}
}
}