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.5, custom template, label
- This topic has 6 replies, 2 voices, and was last updated 8 years, 4 months ago by
Steven Zahm.
-
AuthorPosts
-
01/08/2015 at 7:47 pm #314548
Tim Roberts
ParticipantHi Steve,
My field labels are not displaying. I do not understand it. Can See only phone number. Specifically looking for Organization, Department. Also, would like to know if I can change the name of department and organization the same way I can home address. I do not see this in the shortcode section Need it for a workaround. Thanks.
Tim
01/08/2015 at 8:22 pm #314549Tim Roberts
ParticipantHi Steve,
I wanted to be a bit more explicit on my message about field labels showing. What I specifically want is the ability to do the following:
Display the field titles in the form type “individual”. Those I wish to display are:
- Title
- Organization
- Department
I can see the content of those fields, but cannot see their labels. This is very important for my directory and especially true for my sorting. These are the fields on which people will sort when viewing my directory. I know I can order_by with each of these. The problem is I cannot see the labels.
The other problem is I want to change the name of the labels for display. I know I can change several with the str_target_label=’desired label’. However, I do not see a shortcode for the fields above. So need to both change their display names on the front end as the user views them and also change their display name. What’s the word on this?
Thanks,
Tim
PS – If I can do this, I do not have to change things in the data base that will be overwritten on updates. Trying to avoid that.
01/09/2015 at 10:13 am #314572Steven Zahm
Keymaster@ Tim
Those fields do not show titles … there implied by being part of the name group of info. I really only get this request a couple times a year so I have not considered adding them.
Those labels can be added and in an update safe way to by using custom template override files. You would copy both the
card.php
andcard-single.php
files from the source template, add the labels to those files and then upload them to any of the paths outlined in the QuickTip.Does that help?
01/09/2015 at 2:37 pm #314592Tim Roberts
ParticipantHi Steve,
I have followed the instructions exactly, but have no clue which lines to modify. Is this the area where I would change the display?
* // START -- Set the default attributes array. \\ */ $defaults['terms'] = array(); if ( in_array( 'family_name', $fields ) ) $defaults['fields']['entry'][] = 'family_name'; if ( in_array( 'first_name', $fields ) ) $defaults['fields']['entry'][] = 'first_name'; if ( in_array( 'middle_name', $fields ) ) $defaults['fields']['entry'][] = 'middle_name'; if ( in_array( 'last_name', $fields ) ) $defaults['fields']['entry'][] = 'last_name'; if ( in_array( 'title', $fields ) ) $defaults['fields']['entry'][] = 'title'; if ( in_array( 'organization', $fields ) ) $defaults['fields']['entry'][] = 'organization'; if ( in_array( 'department', $fields ) ) $defaults['fields']['entry'][] = 'department'; if ( in_array( 'contact_first_name', $fields ) ) $defaults['fields']['entry'][] = 'contact_first_name'; if ( in_array( 'contact_last_name', $fields ) ) $defaults['fields']['entry'][] = 'contact_last_name'; if ( in_array( 'bio', $fields ) ) $defaults['fields']['entry'][] = 'bio'; if ( in_array( 'notes', $fields ) ) $defaults['fields']['entry'][] = 'notes'; if ( in_array( 'address_line_1', $fields ) ) $defaults['fields']['address'][] = 'line_1'; if ( in_array( 'address_line_2', $fields ) ) $defaults['fields']['address'][] = 'line_2'; if ( in_array( 'address_line_3', $fields ) ) $defaults['fields']['address'][] = 'line_3'; if ( in_array( 'address_city', $fields ) ) $defaults['fields']['address'][] = 'city'; if ( in_array( 'address_state', $fields ) ) $defaults['fields']['address'][] = 'state'; if ( in_array( 'address_zipcode', $fields ) ) $defaults['fields']['address'][] = 'zipcode'; if ( in_array( 'address_country', $fields ) ) $defaults['fields']['address'][] = 'country'; if ( in_array( 'phone_number', $fields ) ) $defaults['fields']['phone'][] = 'number'; $atts = wp_parse_args( $atts, apply_filters( 'cn_search_atts', $defaults ) );
Also, if this is correct, where do I go to ensure the labels display on the front end. Let me know.
Thanks,
Tim
01/09/2015 at 3:15 pm #314606Steven Zahm
Keymaster@ Tim
That check of code is from the
class.retrieve.php
file in this folder:
../wp-content/plugins/connections/includes/
That has nothing to do with the templates and not in any of the instructions. I really do not suggest altering that file, bad things can happen.
You would only copy both the
card.php
andcard-single.php
files from the source template. I can’t tell you the exact path because I can’t remember which template and which version you’re using.Regardless of the template you would put your label in front of the code for the item you’re adding the label to. As an example the code for the title would be
$entry->getTitleBlock();
to add a label you would add'Title: .
before it so you would have somehting like:'Title: ' . $entry->getTitleBlock();
There may or may not be code in front of or after
$entry->getTitleBlock();
, that does not matter you would add'Title: .
directly before$entry->getTitleBlock();
.The code blocks for org and dept are:
$entry->getOrgUnitBlock()
;
… darn, I forgot, the org and dept are output using a single function so it is not easily done to add labels.
You can use the
echo $entry->getOrganization()
andecho $entry->getDepartment()
functions instead of$entry->getOrgUnitBlock()
but you’ll lose the hCard microdata markup and the ability to have the org and dept as links. Neither of which may matter to you.Hope that helps!
01/10/2015 at 1:48 pm #314683Tim Roberts
ParticipantHi Steve,
I copied the code above onto a test page to see if it would work. I know it is pulling from the proper card file as I have made a couple of changes and have seen them work. The label is still not showing. It shows the title, but not the label. I want it to look like this:
Title: My Title
Organization: My Org
Annual Income: $15 MillionWhere annual income is would normally be department. This is because I can order by department and I must be able to sort via income level. That is critical. Again, I have copied the code exactly on the sample page and I get the output from the image attachment. As you can see, no label visibility. Let me know how to resolve, please.
Thanks,
Tim
Attachments:
You must be logged in to view attached files.01/12/2015 at 8:36 am #314722Steven Zahm
Keymaster@ Tim
Tim, now that I know the template you’re using (from the screenshot)…
Change this block of code in the
card.php
andcard-single.php
file from this:<div style="margin-bottom: 5px;"> <h3><?php $entry->getNameBlock( array( 'format' => $atts['name_format'], 'link' => $atts['link'] ) ); ?></h3> <?php if ( $atts['show_title'] ) $entry->getTitleBlock(); ?> <?php if ( $atts['show_org'] ) $entry->getOrgUnitBlock(); ?> <?php if ( $atts['show_contact_name'] ) $entry->getContactNameBlock( array( 'format' => $atts['contact_name_format'] , 'label' => $atts['str_contact'] ) ); ?> </div>
to this:
<div style="margin-bottom: 5px;"> <h3><?php $entry->getNameBlock( array( 'format' => $atts['name_format'], 'link' => $atts['link'] ) ); ?></h3> <?php if ( $atts['show_title'] ) echo 'Title: ' . $entry->getTitleBlock(); ?> <?php if ( $atts['show_org'] ) echo 'Organization: ' . $entry->getOrganization(); ?> <?php if ( $atts['show_org'] ) echo 'Annual Income: ' . $entry->getDepartment(); ?> <?php if ( $atts['show_contact_name'] ) $entry->getContactNameBlock( array( 'format' => $atts['contact_name_format'] , 'label' => $atts['str_contact'] ) ); ?> </div>
That should do it.
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.