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.6.6, cn_output_phone_number, filter
- This topic has 3 replies, 2 voices, and was last updated 5 years, 8 months ago by
Steven Zahm.
-
AuthorPosts
-
07/01/2017 at 12:25 pm #427660
dominic loiacono
ParticipantHi Steven,
I am customizing card.php (adding font awesome icons instead of labels for address phone etc)
I am inserting my custom code on this lineif ( $atts['show_phone_numbers'] ) ?>
<div class="block"><div class="block1">
<?php echo do_shortcode('[fusion_fontawesome icon="fa-phone" /]'); ?>my problem is that if no phone exists the icons still show up.
is there a way to make it conditional ie
if (!phoneexists ) {} else do my code
the fields that are problematic are phone, address, link and email
there is only one of each if they exist.
Thanks
Dominic
07/03/2017 at 10:53 am #427763Steven Zahm
Keymaster@ dominic
It’s better to hook into the
cn_output_phone_number
filter. That way you can change the HTML markup to suit. Here’s a skeleton filter to get to you started:add_filter( 'cn_output_phone_number', 'cn_output_phone_number', 10, 4 ); function cn_output_phone_number( $html, $phone, $entry, $shortcode_atts ) { // $phone->name is the phone name/type // $phone->number is the phone number. $html = '<span>' . $phone->name '</span> <span>' . $phone->number . '</span>'; return $html; }
YOu can add this filter using the Code Snippets plugin. Of course tweak as needed to use the Font Awesome markup.
Hope this helps!
07/03/2017 at 12:54 pm #427774dominic loiacono
ParticipantThis also worked great. I am always amazed on how flexible connections is.
I think i would like to do the same thing for: address, links, and email instead of hacking card.php
do these have similar filters?
07/03/2017 at 1:40 pm #427775Steven Zahm
Keymaster@ dominic
Yes, there is and they are:
- email ::
cn_output_email_address
- links ::
cn_output_link
Addresses are done a very differently … it’s newer code and the way I’ll me moving forward with the other the fields.
Create this folder:
/wp-content/connections-templates/entry/addresses
then copy this file to it:
/wp-content/plugins/connections/templates/entry/addresses/address-hcard.php
Rename the file to
address-hcard.php
and the edit away. - email ::
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.