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.7.1, custom fields
- This topic has 4 replies, 2 voices, and was last updated 5 years, 11 months ago by
Steve Davis.
-
AuthorPosts
-
12/20/2017 at 10:13 pm #444871
Steve Davis
ParticipantHello
I have cMap running and followed your tutorial for adding custom fields to the Add New Entry Form (all showing well, using Code Snippets plugin) AND I have managed to insert the data from the fields into the card and card-single PHP files okay.
What I cannot work out is how to add the Label for each of those custom fields so they make sense when displayed.
I have this in my card templates:
$text = $entry->getMeta( array( 'key' => 'field_id_abn', // This should match exactly the field id used when registering the custom field. 'single' => TRUE // Do not change this. ) );
But need to enter ABN/ACN: As the label for when this information is displayed.
Can you please advise me.
I have card.php and card-single.php in theme/child/connections-templates/cmap
Many thanks in advance
PS In my code snippets, I am using this
array( 'name' => 'ACN/ABN', // Change this field name to something which applies to you project. 'show_label' => TRUE, // Whether or not to display the 'name'. Changing it to false will suppress the name. 'id' => 'field_id_abn', // Change this so it is unique to you project. Each field id MUST be unique. 'type' => 'text', // This is the field type being added. 'size' => 'regular', // This can be changed to one of the following: 'small', 'regular', 'large' ),
-
This topic was modified 5 years, 11 months ago by
Steve Davis. Reason: Extra information
12/21/2017 at 8:48 am #444933Steven Zahm
Keymaster@ Steve
In the
card.php
andcard-single.php
files where you added the$text = $entry->getMeta(
chunck of code, you need to add this line as mentioned in the tutorial:if ( ! empty( $text ) ) echo '' . esc_html( $text ) . '';
Here, you can add any label you want, just add it to the code. Example:
if ( ! empty( $text ) ) echo '<strong>ABN/ACN:</strong> ' . esc_html( $text ) . '';
Hope that helps!
-
This reply was modified 5 years, 11 months ago by
Steven Zahm. Reason: Correct string closing tag
12/21/2017 at 3:31 pm #444958Steve Davis
ParticipantThanks, Steven. That’s doing the job. One thing for anybody else who sees this, the backslash in Steven’s example <strong/> needs to be , and we have lift off. Much obliged.
if ( ! empty( $text ) ) echo ‘
ABN/ACN: ‘ . esc_html( $text ) . ‘
‘;
12/21/2017 at 3:44 pm #444962Steven Zahm
Keymaster@ Steve
You reply got a little mangled, but I think I get what you are saying… I incorrectly closed the strong tag. I corrected my previous reply.
Thanks!
12/21/2017 at 4:07 pm #444963Steve Davis
ParticipantGreat support. Many thanks, Steve.
-
This topic was modified 5 years, 11 months ago by
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.