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.39.1, custom fields, Gridder, template
- This topic has 10 replies, 2 voices, and was last updated 4 years, 7 months ago by
Steven Zahm.
-
AuthorPosts
-
04/10/2019 at 1:58 pm #489459
Ellen Monroe
ParticipantHi there, I am looking for a way to filter by custom field (preferably without installing any additional plugins) — I already have the custom field added (see attached photo) and it shows up in already on people’s profile page, which is great. 2 things I need to change:
- I need to be able to filter by Custom field (in my case, “Location”) as an additional drop down next to “Category,” and need to be able to have this info be searchable as well.
- I need to be able to remove the line “Custom fields” — it’s fine for it to just be a bullet that says “Location: _____”
Thanks so much!
Attachments:
You must be logged in to view attached files.04/10/2019 at 4:53 pm #489483Steven Zahm
Keymaster@ Ellen
Sorry, this would require custom development which would include additional plugin.
Also, I suggest adding a custom text field instead of using the Custom Fields:
If you decide to use the Custom Fields, CSS can be used to hide the label.
Hope this helps!
04/10/2019 at 6:48 pm #489509Ellen Monroe
ParticipantHi Steven,
No worries, I understand that sometimes additional plugins are required, I just misunderstood what it meant for Connections to support custom fields, and thought that it was something I could do using shortcodes or something, without an additional plugin!
Why do you recommend adding a custom text field using Code Snippets and adding a template override, rather than using Advanced Custom Fields? Also, the article you shared states that the template override file will not be re-written in a wordpress update, but are there any cases I should watch out for where it would be re-written?
Thanks,
Ellen
04/11/2019 at 8:38 am #489547Steven Zahm
Keymaster@ Ellen
RE: Why do you recommend adding a custom text field using Code Snippets and adding a template override, rather than using Advanced Custom Fields?
By adding it the way explained in the dev docs, it automagically adds it as a Content Block Which can be enabled/disabled to display in templates (just like you had enabled the “Custom Fields” content block).
Adding it as a text field also registers is as an option on the Connections : Search settings admin page. Enabling it will tell Connections to also search this when doing keyword searches.
The next update to Connections will actually start hiding, by default, the “Custom Fields” metabox matching core WordPress handling of the same field on its Pages and Posts admin pages. This is not going to be removed, if you find that is does not display, you will be able to click the Screen Options tab in the upper right to turn it back on. Nearly all existing users will not notice any difference, the new hidden default will primarily only affect new installations.
RE: the article you shared states that the template override file will not be re-written in a wordpress update, but are there any cases I should watch out for where it would be re-written?
When WordPress updates a plugin, the existing version plugin files are deleted… So, as long as you do not modify any of the files which exist within the Connections plugin files you do not need to worry about files getting overwritten. This is not a Connections bug or limitation. This is just how WordPress manages updates. Many, many plugin offer ways to use template files which will not be overwritten during updates.
Hope I have thoroughly answered your questions!
04/15/2019 at 3:22 pm #489810Ellen Monroe
ParticipantHi Steven,
Thanks so much for your detailed response. I have followed your instructions and existing documentation exactly, and was able to successfully add a “Location” field that I can edit on the backend for each entry. I can also return search results based on “Location” now.
Two issues remain:
- I need to be able to add another drop down filter for “Location,” next to the category one that is available by default.
- The “Location” field is not visible on an entry’s preview panel or in an entry’s profile view page. I’m not sure if this is related to me putting the code in the wrong spot in the card.php and card-single.php files — the documentation just says to “add the following code to where you want the custom field data to display.” Ideally, the custom field data would display before the biography text starts on the preview panel, and at the end of the biography text on the profile page. I placed the code at the end of the file, just before the last “</div> tag. Any guidance you could give on proper placement would be much appreciated.
Also, I think it will be a definite improvement to hide the “Custom Fields” metabox by default – it was definitely confusing to see that box and read instructions about custom fields, when that isn’t the best way to go about adding a custom field!
In response to your note on another thread, I will definitely leave a positive review once my page is up and running. You’ve been really helpful.
Thanks again,
Ellen
04/15/2019 at 4:26 pm #489826Ellen Monroe
ParticipantCorrection — looks like I actually can’t search by this new field yet.
04/15/2019 at 6:15 pm #489827Steven Zahm
Keymaster@ Ellen
RE: I think it will be a definite improvement to hide the “Custom Fields” metabox by default – it was definitely confusing to see that box and read instructions about custom fields, when that isn’t the best way to go about adding a custom field!
Yep, I understand. The confusion itself comes directly from WP. I’ll try to explain…
Pre WP 5 if you scrolled to the bottom of the edit page/post admin page you would find a section named “Custom Fields”. This was a generic way to add support in core WP. In WP 5, you need a plugin to enable this feature again.
https://wordpress.org/plugins/custom-fields-gutenberg/
On the add/edit page/post admin pages you find other sections, called metaboxes, often these are added by themes and plugins. These are also called “custom fields”. Notice the lack of capitalization.
Connections mimics these features. So it has a “Custom Fields” section (metabox) and “custom fields” which can be registered as covered in the dev docs.
RE: looks like I actually can’t search by this new field yet.
Navigate to the Connections : Settings admin page and click the Search tab enable search for the custom text field you registered.
Now, when you do keyword searches, that field will be searched for matches.
RE: I need to be able to add another drop down filter for “Location,” next to the category one that is available by default.
Adding such a feature would require custom development.
RE: The “Location” field is not visible on an entry’s preview panel or in an entry’s profile view page.
Make sure the edit the correct template file. This is probably one of the most common mistakes.
The Gridder template files are found in this folder:
../wp-content/plugins/connections-gridder/
The
card.php
file is the template used when displaying the grid of photos with the contact info panel.After adding the code to display the field, you will very likely have to add custom CSS too. In order to achieve the grid layout, both the font size and line height are set to default to
0
. So, you’ will need to add CSS to set the font-size and line-height to the desired sizes.Place the code at line
119
to have it display before the bio excerpt. Make sure to take care of the required opening/closing php tags (<php
and?>
)The
card-single.php
file is used to display the entry detail/profile page. Place the code in line72
to have it display after the bio.RE: I placed the code at the end of the file, just before the last “ tag.
Make sure to take the code is between the required opening/closing php tags (
<php
and?>
) otherwise the code will just be displayed as text on the screen on not run by WordPress/Connections.Hope this helps!
04/16/2019 at 1:51 pm #489972Ellen Monroe
ParticipantHi Steven,
Re: Adding such a feature [additional drop downs] would require custom development.
I think I must have misunderstood – when you first responded to this question, you said it would require custom development and additional plugins. I took this to mean that if I downloaded the plugins specified and added the additional field using the method you suggested, I could add the additional drop down. I have followed your instructions closely, with the hope that once I added that field properly, you would be able to explain how to add the drop down.Re: Make sure the edit the correct template file.
As per instructions on this page I was not editing the plugin’s template file, but rather editing a copy of that file, which is located in the new folder I created, located at “wp-content/connections-templates/gridder/” – is this the correct location? I moved the text to the appropriate lines in the card-single.php file and the card.php file. I have been using <?php and ?> tags — you mentioned using “<php” without the question mark, so that could be an issue. I wasn’t able to find the appropriate CSS elements to change using the inspector, because the field isn’t currently displaying, so that could be the issue? I am using the same ID for the field in both the php files and the Code Snippet, but maybe I am confused about what the instructions mean by “Field id”? I’ve attached photos of the Code Snippet I added and the code I added in the php. Hopefully this illumintes something.Again, thank you so much for your help in getting this off the ground.
Ellen
Attachments:
You must be logged in to view attached files.04/16/2019 at 3:18 pm #489984Steven Zahm
Keymaster@ Ellen
RE: when you first responded to this question, you said it would require custom development and additional plugins. I took this to mean that if I downloaded the plugins specified and added the additional field using the method you suggested, I could add the additional drop down.
Just so I am on the same page… you are referring my reply from here, yes?
If that is the case, I do apologize for the confusion!
The custom development I was referring to was the development required to add the drop down and the filter/search with that drop down. Registering the custom field was not the custom development I was referring to.
When I mentioned another plugin, I was saying this could result in another plugin since you said you did not want another plugin.
RE: I was not editing the plugin’s template file, but rather editing a copy of that file, which is located in the new folder I created, located at “wp-content/connections-templates/gridder/” – is this the correct location?
Yes, that should work.
In this folder you have two files,
card.php
and card-single.php`, correct?And these are the files you have edited, correct?
RE: the field isn’t currently displaying
let’s focus on the
card-single.php
file since I know that does not require any CSS.I can not tell from the screenshot what line numbers the code was inserted on. I suggested line
72
based on where you said you wanted it inserted. For it to show the entry should have a bio and that field should be set to display (which it does by default).If you want it to display even if the entry does not have a bio, try inserting the code on line
75
instead. That should cause the field to display between the bio and notes instead of after the bio.Also, the entry must have something in the field in order for something to be outputted.
You could also add
echo 'I'm Here!";
just to make sure you are inserting the code in the right spot and something is being output.Hope this helps!
04/16/2019 at 4:39 pm #489997Ellen Monroe
ParticipantHi Steven,
Re:Just so I am on the same page… you are referring my reply from here, yes?
Yep, that is the comment I was referring to — so, just to clarify, you are not able to help me add the additional drop down? Would it be easier to add an additional drop down for a non-custom field?Re:In this folder you have two files
Yes — that folder contains 2 files, the ones you mentioned, and those are the ones I have edited. BUT, this issue seems to partially be user error – I realized I was editing the files for my live site rather than my staging site and tried again. This time, the card.php file is showing up fine. I would still like to figure out how to refer to the element both in CSS and in the shortcode, so that I can make it bold and add a string to get the label text to show up — something like “str_select” but for the custom field.Re: let’s focus on the card-single.php
This one is still giving me issues. I tried pasting the entire text on both line 72 and line 75, and I am receiving a syntax error that says there is an unexpected “<” — this is really weird, since the only < on that line is the one for “<?php” I definitely have populated both the bio field and custom field for all entries. Not sure what’s going on here…Thanks,
Ellen
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.