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.1.1, autop, br tags, custom fields
- This topic has 15 replies, 3 voices, and was last updated 8 years, 6 months ago by
Steven Zahm.
-
AuthorPosts
-
09/10/2014 at 8:05 pm #303549
Susan
ParticipantI’m starting to work on customized versions of the cMap template.
[1] WordPress is adding p and/or br tags after and around every line – this is not a result of my changes, it was happening before I started customizing. (I’m pretty sure this started after all the updates surrounding WP 4.0, but can’t go back to be sure.) I don’t want to disable autop sitewide. What can I do to disable it either for the Connections post type or for each template, or to modify the template to prevent it?
[2] Where are the directions for adding a custom field or fields to a template?09/10/2014 at 8:55 pm #303553Steven Zahm
Keymaster@ Susan
re: WordPress is adding p and/or br tags after and around every line – this is not a result of my changes, it was happening before I started customizing. (I’m pretty sure this started after all the updates surrounding WP 4.0, but can’t go back to be sure.) I don’t want to disable autop sitewide. What can I do to disable it either for the Connections post type or for each template, or to modify the template to prevent it?
This is most often caused by the theme. Those from ThemeForest are especially guilty of adding p and br tags to shortcode output. See this FAQ for some helpful tips. The update in the yellow tinted box usually fixes it for almost everyone so I would try that first.re: Where are the directions for adding a custom field or fields to a template?
The custom fields when adding an entry? Those can be enabled for display on the Connections : Settings admin page under the Display tab. If you want to add other custom like Education Level, Hours, Income Level and Languages, there’s no doc available on the web yet. I highly recommend referring to those plugins code they are freely available and are well documented using phpDoc and inline comments.Hope that helps!
09/12/2014 at 3:49 pm #303778Susan
ParticipantAutop: found the problem, it was a setting in another plugin. Thanks!
Custom Fields: I enabled them and have added a field to the entries. It’s just a single text field. Can I add it to the templates with the code I would use to add a custom field to any other page template?
<?php echo get_post_meta($post->ID, 'key', true); ?>
09/13/2014 at 6:23 pm #303857Steven Zahm
Keymaster@ Susan
Yes, there is a similar command to place custom meta fields … use this within the template:
$entry->getMeta( array( 'key' => 'meta-key-name', 'single' => TRUE ) );
Can you share the link to your directory after you’re finished? I’m curios to see what you’ve done.
09/15/2014 at 5:19 pm #304130Susan Paigen
GuestI added the code you sent right after the organization block line, nothing on the page:
<?php $entry->getMeta( array( 'key' => 'specialization', 'single' => TRUE ) ); ?>
. “Specialization” is the name I assigned to the custom field, I couldn’t find any way to verify the slug but I can’t imagine what else it would be. I tried with a capital S in the code just to check, didn’t make a difference.Also, when I get it to work I need something that’s basically “if the field has content, then . . . because I want to be able to put in a label. Would it be `if ( $entry->getMeta(specialization) != ” ){…}
The default display for custom fields is something like
‘<h3>Custom Fields</h3>
` then field name – field value as a bulleted list item.
It seems unlikely anyone would want their field results in a section titled “Custom Fields”. I commented out the content block to get control.Unrelated question – is there an attribute I can specify in the shortcode which would display the bio without the show-hide function?
09/16/2014 at 10:30 am #304209Steven Zahm
Keymaster@ Susan
Oops …
I forgot the
echo
that’s needed because the function returns the data. The code would be:
<?php echo $entry->getMeta( array( 'key' => 'specialization', 'single' => TRUE ) ); ?>
What you could do for the label is this:
$spec = $entry->getMeta( array( 'key' => 'specialization', 'single' => TRUE ) ); if ( $spec ) echo "Label: $spec";
re: It seems unlikely anyone would want their field results in a section titled “Custom Fields”.
True … but since they can be anything to any user I have to use something as a default.You can use these filters to control output:
cn_entry_output_content_block
cn_entry_output_content_block_container
cn_entry_output_meta_key
cn_entry_output_meta_container
These can be found in this file:
class.entry-data.php
You’ll have to refer to the code and play with them to figure them out but they should provide everything you need to complete control the output without having to edit the core Connections files.
Hope that helps!
09/17/2014 at 5:31 pm #304419Susan Paigen
GuestThanks for the code. I have not had time to work on the custom field display yet. I love being able to sort entries into groups using both category_in and category_exclude!
Right now I am dealing with some sort of error. The customized template is working on the site, but if I run a search on the site which returns a page containing directory listings the page excerpt says “ERROR: Template not found….”, although the page is working. If the page has multiple calls by category the error message is duplicated for each category.
The website error logs include:
`[15-Sep-2014 19:07:17 UTC] WordPress database error Unknown column ‘number’ in ‘where clause’ for query SELECT snc_6EXBM7SN_connections.id
FROM snc_6EXBM7SN_connections
WHERE (number LIKE ‘orr%’ ) made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/roots/page.php’), get_template_part, locate_template, load_template, require(‘/themes/roots/loop-page.php’), the_content, apply_filters(‘the_content’), call_user_func_array, do_shortcode, preg_replace_callback, do_shortcode_tag, call_user_func, cnShortcode::view, cnShortcode_Connections::shortcode, cnRetrieve->entries, cnRetrieve->search
[15-Sep-2014 19:07:17 UTC] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘)’ at line 3 for query SELECT snc_6EXBM7SN_connections_address.entry_id
FROM snc_6EXBM7SN_connections_address
WHERE () made by require(‘wp-blog-header.php’), require_once(‘wp-includes/template-loader.php’), include(‘/themes/roots/page.php’), get_template_part, locate_template, load_template, require(‘/themes/roots/loop-page.php’), the_content, apply_filters(‘the_content’), call_user_func_array, do_shortcode, preg_replace_callback, do_shortcode_tag, call_user_func, cnShortcode::view, cnShortcode_Connections::shortcode, cnRetrieve->entries, cnRetrieve->search’, and the second error on address is duplicated on ‘phone.entry_id’, otherwise identical.Sorry to send all that stuff, I don’t know what you do or don’t need. The “line 3” reference does not seem to refer to either the template cmap.php or card.php pages. In cmap.php line 3 is in the header comments. In card.php it’s
<div class="cn-left">
.The template is located in the plugin folder.
Links:
The directory: http://www.sierranevada.edu/contacts/
A page with several calls by category: http://www.sierranevada.edu/academics/teacher-education/faculty-staff/
A page showing a different display format from the same template, in case you’re interested: http://www.sierranevada.edu/academics/fine-arts/faculty/
A search for “Bouchard” will show you the error messages.
Thanks for your help!
09/18/2014 at 11:00 am #304452Steven Zahm
Keymaster@ Susan
I guess I have to questions…
What plugin are you using to enhance the core WordPress search? I ask because WordPress does not use a
/search/
endpoint to display results. So this has to be coming from somewhere else.My guess is whatever is doing this is also possible interfering or incorrectly parsing the Connections shortcode. Really, the except of the search results should do a strip_shortcode() on that excerpt because not doing so can cause all sort of odd thing to happen with shortcodes because the content will be truncated by WordPress when it creates the search excerpt. So, I would consider that a bug with whatever is enhancing the WP search.
The db errors those queries definitely do not make sense. Can you share a screen capture of the Connections : Settings Search tab? I want to duplicate your settings to see if I replicate the errors.
09/18/2014 at 12:01 pm #304456Susan Paigen
GuestThe search plugin is Relevanssi. I turned it off to see what would happen, but I can’t tell because WordPress search isn’t returning the directory listings at all. It’s on now.
On the Connections:Settings Search tab everything is checked, including FULLTEXT and Keyword Search.
09/18/2014 at 1:01 pm #304462Steven Zahm
Keymaster@ Susan
re: I turned it off to see what would happen, but I can’t tell because WordPress search isn’t returning the directory listings at all.
Yes, that is what I would expect as WordPress can not search the output of the shortcodes. It seems when Relevanssi builds its index, Connections is not fully loaded which would be why the template not found message would appear. My guess is Relevanssi runs after Connections is loaded but before any of the templates are registered. Unfortunately there is not much I can do about that.re: On the Connections:Settings Search tab everything is checked, including FULLTEXT and Keyword Search.
Ok, that’s the default settings but I can not replicate the db error message. Is this error in the log only those two times from a few days ago or are they there repeatedly? -
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.