@ Craig
RE: I wanted to change the word “Radius” to “Max distance” and tried Say What and other methods to no avail.
Yeah, this addon, since it is still beta, is still not 100% translation ready. Editing the code was the only way to make the change.
RE: You have a way to change the zip placeholder, but not that label. Do I have another option?
Hmmm… not sure I follow. There are no labels. Can you attach a screenshot showing what you mean?
RE: Do I have another option? Can you promise to never update your code? (kidding!).
lol, Actually I plan on changing it, a lot, this year. I want to convert this to a new WordPress 5 Editor block. This way I can make setup point and click. :)
RE: Is there a cache plugin you recommend or know is compatible? Or any to avoid?
I personally use and like WP Rocket. For me, it just works. I use to use W3TC. It is a very powerful caching solution, but, I found myself constantly fiddling with its settings after every, single, update to get things working again. When I say updates… not specifically Connections, but WP,the them, any other plugin. In providing support, I come across many users using Super Cache. Another good plugin, but it always seemed to be a little quirky.
Just my experience, so, your result may vary :)
RE: When someone comes to the site I have the multi-category-search showing and [connections]. I would like there to be only one organization showing (I have a category of “Sample” with one entry) sort of as a default. I can put a screen shot of it under your shortcode as a workaround but that’s not ideal. Suggestion?
You could try using this shortcode:
[connections category=X]
Where X is the category ID of “Sample”
For your use, that may or may not work all that well. You might get better results by adding this Code Snippet. I’ve never tested it against the advanced search though.
function cn_reset_category_search_filter( $posts, $WP_Query ) {
global $wp_query;
$shortcode = 'connections';
$pattern = get_shortcode_regex();
// Grab the array containing all query vars registered by Connections.
$registeredQueryVars = cnRewrite::queryVars( array() );
foreach ( $posts as $post ) {
// If we're in the main query, proceed!
if ( isset( $WP_Query->queried_object_id ) && $WP_Query->queried_object_id == $post->ID ) {
/*
* $matches[0] == An array of all shortcode that were found with its options.
* $matches[1] == Unknown.
* $matches[2] == An array of all shortcode tags that were found.
* $matches[3] == An array of the shortcode options that were found.
* $matches[4] == Unknown.
* $matches[5] == Unknown.
* $matches[6] == Unknown.
*/
if ( preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches )
&& array_key_exists( 2, $matches )
&& in_array( $shortcode, $matches[2] ) )
{
// Parse the shortcode atts.
$atts = shortcode_parse_atts( $matches[3][ array_search( $shortcode, $matches[2] ) ] );
// Remove the cn-image query vars.
$wp_query->query_vars = array_diff_key( (array) $wp_query->query_vars, array_flip( array( 'src', 'w', 'h', 'q', 'a', 'zc', 'f', 's', 'o', 'cc', 'ct' ) ) );
// If the `category` shortcode option is set and the user is not performing a search of any type, limit the results the categories defined by the shorcode option.
// If a Connections query var is set, show all results according to the query.
if ( isset( $atts['category'] )
&& (bool) array_intersect( $registeredQueryVars, array_keys( (array) $wp_query->query_vars ) )
)
{
unset( $atts['category'] );
// Rewrite the $atts array to prep it to be imploded.
array_walk( $atts, create_function( '&$i,$k','$i="$k=\"$i\"";' ) );
$replace = '[' . $shortcode . ' ' . implode( ' ', $atts ) . ']';
} else {
// Rewrite the $atts array to prep it to be imploded.
array_walk( $atts, create_function( '&$i,$k','$i="$k=\"$i\"";' ) );
$replace = '[' . $shortcode . ' ' . implode( ' ', $atts ) . ']';
}
// Replace the shortcode in the post with something a new one based on you changes to $atts.
$post->post_content = str_replace( $matches[0][ array_search( $shortcode, $matches[2] ) ], $replace, $post->post_content );
}
}
}
return $posts;
}
add_filter( 'the_posts', 'cn_reset_category_search_filter', 1000, 2 );
RE: Some of my entries have the same contact email and that is appropriate in my usage. Am I doomed with regards to the Link plugin?
I guess that depends… it it was hoped that contact could edit all entries with their email address … sorry, but that will not work because it is a one-to-one relationship, not one-to-many.
If you allow the contact to register and rely on the autolink feature, based on email. It will seem random as to which entry the user will get linked to.
I think I would suggest only adding the entries that you want to linked to users first. Ensure they get their proper links and then import any of the schools where the contact email is displicate
Hope that makes sense!
RE: And connections-initial-search-results is not working for me. It is installed and the box is checked to suppress results.
Try testing without the caching enabled on your site. Before sure to flush it first. Some caching plugin will still serve old cached pages even when deactivated (cough, cough WP Super Cache). If that work, just exclude the directory page.
I know this is long… but I hope it helps!
