Custom field description
This topic contains 12 replies, has 4 voices, and was last updated by Kiran 7 years, 11 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket-
AuthorPosts
-
March 9, 2017 at 10:16 am #366302
Hi,
I want to add an “help” icon for certain fields on the add listing form and thought it would be a good idea to use a hyperlinked font-awesome in the field description. This works fine for descriptions in the language file, however, if the field is a custom field (e.g. categories) it doesn’t like the hyperlinked font-awesome code.
So, for example, I added this code but it doesn’t stick:-
<a target="_blank" href="../add-a-listing-guide/#guide-import"><i class="fa fa-info-circle" aria-hidden="true"></i></a>
Any suggestions as to how I achieve this?
March 9, 2017 at 11:53 am #366319Hi Mark,
Have you tried adding the fontawesome icon directly using custom CSS? Give it a try and let us know if it works.
Example
div#geodir_claimed_row:before { content: "\f006"; font: normal normal normal 15px/1 FontAwesome; }
March 10, 2017 at 1:59 pm #366586Hi,
I’ve given it a go but unfortunately I don’t think it’ll work for me.
I tried a few variations, including :-
.geodir_placecategory_row :before { content: "\f05a"; font: normal normal normal 15px/1 FontAwesome; }
This did nothing.
.geodir_message_note:before { content: "\f05a"; font: normal normal normal 15px/1 FontAwesome; }
This does add the fontawesome icon, however, it shows on all field notes, but I only want it to appear on the ones I specify.
The other issue is I can’t see how we would be able to add a hyperlink, which is essential as I want to link through to the relevant section on a help/user’s guide.
Any other suggestions greatly appreciated.
March 10, 2017 at 6:01 pm #366625Please explain exactly what you are trying to do possibly with a screenshot and we will provide the correct CSS.
Thanks
March 10, 2017 at 10:58 pm #366653Hi Paolo,
The intention is to have a help icon (using font-awesome) on certain fields that will link through to relevant help info (on a user guide page.) So, for example, I would have this on categories, address, images etc.
I felt it was best to place this after the note below certain fields. It is possible to achieve when the field note is in the functions.php file (I have a note for Social Import) or if the note is in a language file. However, a few field notes are in the custom field settings. It was the latter I was trying to address. I need the link to be different for each note as I want it to link to different information on my user guide.
I’ve mocked up an example of what I want it to look like.
Hope this makes sense.
March 11, 2017 at 6:51 pm #366743I’ve flagged this for the develpoers, I hope there is a hook for that, otherwise I’m sure they’ll have an alternative solution for you. They’ll reply on Monday though, now they are off.
Thanks
March 12, 2017 at 11:39 pm #366896Ok, thanks Paolo.
I look forward to receiving their advices.
Mark
March 13, 2017 at 7:53 pm #367028I just thought of 1 thing, if doing it via translation file works, why don’t you do it for all fields that way?
All fields have a default description and all text string can be modified via translation files…
Let us know,
Thanks
March 14, 2017 at 10:00 am #367120Hi Mark,
You can achieve this by using hook https://wpgeodirectory.com/codex/codex/geodirectory_filters/geodir_filter_geodir_post_custom_fields/ (https://github.com/GeoDirectory/geodirectory/blob/7b0a3e58f90462f349b0aaebe6a7a9156c11e421/geodirectory-functions/custom_fields_functions.php#L148)
You can append your extra description to the existing description stored in “desc” field.
Thanks,
KiranMarch 17, 2017 at 2:40 pm #368098Hi Paolo and Kiran,
As I don’t quite understand how the hook approach would work I opted for Paolo’s approach instead.
However, I found that if I add a default description (e.g. for Category) in to the geodirectory language file this doesn’t work (whether I leave the description blank on the custom field or not.)
Taking Category as an example, there seem to be a couple of possible places to update the description:-
line 4943 (to replace “SELECT listing category FROM here. SELECT at least one CATEGORY”), or
line 7343(t replace “Select listing category from here. Select at least one category”)As mentioned above, neither worked. Any thoughts as to why the default description doesn’t show?
Not: I did try the approach of changing the field title instead, however, found out that changing this for category and address had the negative effect of the font awesome icon also appearing on listing details (because the same field names are used there.)
March 20, 2017 at 4:16 am #368489Hi Mark,
> However, I found that if I add a default description (e.g. for Category) in to the geodirectory language file this doesn’t work (whether I leave the description blank on the custom field or not.)
<
You have re-saved category field with empty description, so now category description becomes empty.
If you are using default field description saved then you can translate it directly via .po file translation. But if you have changed field description and saved then you should use our custom DB field translation method.
For this you have to first save field description from fields settings then via running GeoDirectory -> GD Tools -> Load custom fields translation will adds new description texts to db-language.php file.
Now you can able to update your .po file to include new description texts into .po file for translation purpose.
See more about how to translate custom fields https://wpgeodirectory.com/docs/translating-custom-fields/> As mentioned above, neither worked. Any thoughts as to why the default description doesn’t show?
<
You have re-saved category field with empty description, so now category description doesn’t show.FYI: I checked in and the way Paolo suggested works fine that you asking to about.
Ex: My category description saved “Select listing category from here. Select at least one category” and i translated to it “Select listing category from here. Select at least one category. <i class=”fa fa-info-circle” aria-hidden=”true”></i>”
Now category description showing info icon with link to page.Let us know.
Thanks,
KiranMarch 22, 2017 at 11:19 am #369038Hi Kiran,
That’s great – I’ve now got it working how I want it.
cheers,
MarkMarch 22, 2017 at 11:22 am #369040Thank you for letting us know.
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket