03/16/2017 at 12:37 pm
#415943
Keymaster
@ Michael
Untested, try this code use the Code Snippets plugin to add it.
// Register custom Content Blocks.
add_filter( 'cn_content_blocks', 'registerContentBlocks' );
add_action( 'cn_entry_output_content-entry_field-home', 'renderHomeContentBlock', 10, 3 );
add_action( 'cn_entry_output_content-entry_field-work', 'renderWorkContentBlock', 10, 3 );
function registerContentBlocks( $blocks ) {
$blocks['entry_field-home'] = 'Home Iformation';
$blocks['entry_field-work'] = 'Work Information';
return $blocks;
}
function renderHomeContentBlock( $entry, $shortcode_atts, $template ) {
$entry->getAddressBlock( array( 'type' => 'home' ) );
$entry->getPhoneNumberBlock( array( 'type' => 'homephone' ) );
$entry->getEmailAddressBlock( array( 'type' => 'work') );
}
function renderWorkContentBlock( $entry, $shortcode_atts, $template ) {
$entry->getAddressBlock( array( 'type' => 'work' ) );
$entry->getPhoneNumberBlock( array( 'type' => 'workphone' ) );
$entry->getEmailAddressBlock( array( 'type' => 'work') );
}
To turn these “on”, navigate to the Connections : Settings and click the Display tab. Under the Content Block section you will have two no blocks. You can enable them and adjust the order as desired by drag and drop.
After you do this, you should use the Template Customizer for cMap and disable the disable of addresses and phone numbers otherwise they’ll display twice.
Hope this helps.
