Support has been upgraded!
The Support Forum is closed. Not to worry! Providing the top quality support you expect and we're known for will continue! We're not ending support, just changing where you submit requests. This will provide you with the best experience possible.
Premium Support
Have you purchased an addon for Connections such as one of our premium templates or extensions with a valid license and you need help?
Please open a Support Ticket in your user account.
Free Support
Are you using the free Connections plugin? Don't worry, you are still very important to us! We are still providing you with the same high quality support that we're known for.
Please open a new support topic in the WordPress support forums for Connections.
Tagged: 8.5.32, content block
- This topic has 6 replies, 2 voices, and was last updated 6 years ago by
Steven Zahm.
-
AuthorPosts
-
03/14/2017 at 4:20 pm #415589
Michael Schmidt
ParticipantGreat plugin!
Some of my connections have work and home phone numbers and addresses. I’d like the work phone numbers to go under the work addresses and the home phone numbers to be under the home addresses. Instead of addresses being in one block then the phone numbers in another. Is there a way to do this?Thank you in advance.
03/15/2017 at 10:42 am #415696Steven Zahm
Keymaster@ Michael
It is possible, but not easily because it requires coding to do since there is no actual relationship between addresses and phone numbers. If you are familiar with PHP coding, I can provide you with some direction. If you are not, I do provide customization services. If you are interested, let me know.
03/16/2017 at 10:56 am #415922Michael Schmidt
ParticipantThanks for the quick reply.
I know a little php coding. I’m learning as I go. If you don’t mind pointing me in the right direction, I’d like to give it a shot first. And then if I can’t manage it, I’ll talk to my client and have you get us a quote.Thanks.
03/16/2017 at 12:37 pm #415943Steven Zahm
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.
03/16/2017 at 4:02 pm #415949Michael Schmidt
ParticipantThank you!
It works great on the main directory page where it lists all the employees, but when you click an individual it’s still separated.
Any thoughts on that?03/16/2017 at 4:28 pm #415955Michael Schmidt
ParticipantActually, I think I found a solution. I went in and made a couple changes to the card-single file.
Instead of it being:
if ( $atts[‘show_addresses’] ) $entry->getAddressBlock( array( ‘format’ => $atts[‘addr_format’] , ‘type’ => $atts[‘address_types’] ) );
if ( $atts[‘show_phone_numbers’] ) $entry->getPhoneNumberBlock( array( ‘format’ => $atts[‘phone_format’] , ‘type’ => $atts[‘phone_types’] ) );
I changed it to:
if ( $atts[‘show_addresses’] ) $entry->getAddressBlock( array( ‘format’ => $atts[‘addr_format’] , ‘type’ => ‘work’ ) );
if ( $atts[‘show_phone_numbers’] ) $entry->getPhoneNumberBlock( array( ‘format’ => $atts[‘phone_format’] , ‘type’ => ‘workphone’ ) );if ( $atts[‘show_addresses’] ) $entry->getAddressBlock( array( ‘format’ => $atts[‘addr_format’] , ‘type’ => ‘home’ ) );
if ( $atts[‘show_phone_numbers’] ) $entry->getPhoneNumberBlock( array( ‘format’ => $atts[‘phone_format’] , ‘type’ => ‘homephone’ ) );I don’t know if that’s the best solution but it gets the job done. Thank you for your help!
03/17/2017 at 10:59 am #416057Steven Zahm
Keymaster@ Michael
re: I went in and made a couple changes to the card-single file.
That’s another way of doing… you could have use the Template Customize to do the same for the single entry profile view too.
On the Connections : Settings admin page under the Display tab, there is a section for Content block to be displayed on the single entry view, just like the list view.
While in the Template Customizer you can click an entry name (any entry) and adjust the settings to hide the address and phone info just like you did for the results list view.
Hope this helps!
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.