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.7, code snippets
- This topic has 3 replies, 2 voices, and was last updated 9 years ago by
Steven Zahm.
-
AuthorPosts
-
07/24/2017 at 1:08 pm #430082
Dwight Bailey
ParticipantHi there, Steven.
This is Steve K. from UF Dept of Chemistry.
Without editing $defaults[‘message’] in /wp-content/plugins/connections/includes/template/class.template-parts.php?
When we have a search, we do want to see a message if not found, like on https://www.chem.ufl.edu/directory/ .
But when we set up multiple categories on a page (such as on https://harris.chem.ufl.edu/group-members/ ), if a category is blank we just want it to be missing and not display “No Results.”
I did try a couple of things:
- Unchecked the “Show Clear Search Message” option in setup.
-
Pasted various code in various positions within the template I created:
- global $defaults, $atts;
$defaults[‘message’] = ”;
$atts[‘message’] = ”;
$atts[‘message’] = apply_filters( ‘cn_list_no_result_message’ , ” );
cnTemplateFactory::register( $atts );
remove_action( ‘cn_list_no_results’, array( __CLASS__, ‘noResults’ ), 10, 2 );
- global $defaults, $atts;
So any thoughts on whether it is possible to turn off this message on specific pages (or short code sets) and leave it on others?
As always, Thanks!
Steve K.
-
This topic was modified 9 years ago by
Dwight Bailey.
07/24/2017 at 4:31 pm #430118Steven Zahm
Keymaster@ Steve
I’ve not tested, but this should work…
function cn_remove_list_no_result_message() { remove_action( 'cn_list_no_results', array( 'cnTemplatePart', 'noResults' ), 10 ); } add_action( 'plugins_loaded', 'cn_remove_list_no_result_message', 12 );Add it a a new code snippet using the Code snippets plugin.
Hope this helps, let me know.
07/24/2017 at 7:07 pm #430144Dwight Bailey
ParticipantThanks, Steve Z.!
Actually, I pasted your code near the top of my template itself, right below “if ( ! defined( ‘ABSPATH’ ) ) exit;” and that worked! Pretty impressive for it to work without you even having to test it LOL. This is great, because then I can easily control it, and have the comment on one page, and NOT on a different page, simply by having 2 identical templates (except that one would have your code, the other would not).
<
p>Using code snippets would be great too, except I think that would remove the comment throughout that site.</p?
Thanks!! You rock.
Steve K.
steve@chem.ufl.edu07/25/2017 at 10:06 am #430249Steven Zahm
Keymaster@ Steve
RE: Using code snippets would be great too, except I think that would remove the comment throughout that site.
Yes, using the code, as I gave you, in Code Snippets would have made it a global change. By changing the action name from
plugins_loadedtocn_action_list_before-{template-slug}where{template-slug}is the, well, the template slug name. For example,cmap. So the full action name for cMap would becn_action_list_before-cmap.Hope that helps!
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.
