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.
- This topic has 9 replies, 2 voices, and was last updated 7 years, 4 months ago by
Claude Dagenais.
-
AuthorPosts
-
05/05/2016 at 4:31 pm #375337
Claude Dagenais
ParticipantIs it possible within the shortcode to define the text that will appear in place of the links (ie Visit our website) instead of having to define a link title for each entry?
Currently if I replace in the link format the element %title% with text, the new text is displayed but I loose the link.
tx05/06/2016 at 9:32 am #375405Claude Dagenais
ParticipantI just want to add that I found a temporary solution to do this using CSS and that I could change your file class.entry-output.php to achieve this in PHP but I rather have a clean solution if one exist.
You can see it there
tx05/06/2016 at 12:09 pm #375415Steven Zahm
Keymaster@ Claude
You could use the
cn_output_link
hook to change the output for a link too, like so (untested):add_filter( 'cn_output_link', 'Claude_cn_output_link', 10, 4 ); function Claude_cn_output_link( $html, $link, $entry, $atts) { $targetOptions = array( 'new' => '_blank', 'same' => '_self' ); $url = cnSanitize::field( 'url', $link->url ); $target = array_key_exists( $link->target, $targetOptions ) ? $targetOptions[ $link->target ] : '_self'; $follow = $link->follow ? '' : 'rel="nofollow"'; $html = '<span class="liens_en" style="font-weight:700"><a class="url" href="' . $url . '" ' . $target . ' ' . $follow . '>Visit us on the web !</a></span>'; return $html; }
Hope that helps!
-
This reply was modified 7 years, 4 months ago by
Steven Zahm. Reason: Added missing semi-colon
05/06/2016 at 1:50 pm #375448Claude Dagenais
ParticipantExcept for a missing semicolon this is exactly what I was looking for. Thank you so much once more and have a great weekend!
05/06/2016 at 2:14 pm #375451Claude Dagenais
ParticipantIn case it can help someone, since I have a multilingual website using wpml and that I use WPML Shortcodes here is the final code to make this work with 2 languages:
add_filter( 'cn_output_link', 'th_cn_output_link', 10, 4 ); function th_cn_output_link( $html, $link, $entry, $atts) { $url = cnSanitize::field( 'url', $link->url ); $th_langue = wpml_e__if_language( 'Visit us on the web !', 'en' ); wpml_e__if_language( 'Visitez-nous sur le web !', 'fr' ); $html = '<a class="url" href="' . $url . '" target="_blank">' . $th_langue . '</a>'; return $html; }
-
This reply was modified 7 years, 4 months ago by
Steven Zahm. Reason: Fix code block
05/06/2016 at 2:18 pm #375456Claude Dagenais
Participantadd_filter( 'cn_output_link', 'th_cn_output_link', 10, 4 ); function th_cn_output_link( $html, $link, $entry, $atts ) { $url = cnSanitize::field( 'url', $link->url ); $th_langue = wpml_e__if_language( 'Visit us on the web !', 'en' ); wpml_e__if_language( 'Visitez-nous sur le web !', 'fr' ); $html = '<a class="url" href="' . $url . '" target="_blank">' . $th_langue . '</a>'; return $html; }
-
This reply was modified 7 years, 4 months ago by
Steven Zahm. Reason: Fix code block
05/06/2016 at 2:19 pm #375457Claude Dagenais
ParticipantCrap I don’t know how to share code here anyhow it works! tx
05/06/2016 at 2:23 pm #375460Steven Zahm
Keymaster@ Claude
Great to hear the code was what you were looking for! I fixed the missing semi-colon and the code block in your replies.
05/06/2016 at 2:30 pm #375461Claude Dagenais
Participantthe $html line is missing a part of the code in my post so I’ve attached the file FYI
Attachments:
You must be logged in to view attached files.05/06/2016 at 4:53 pm #375479Claude Dagenais
ParticipantLast update since the problem is solved for good. I had to make a small change to the code because of my own stupidity. I’ve attached it if it can help someone.
Attachments:
You must be logged in to view attached files. -
This reply was modified 7 years, 4 months ago by
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.