Include a link in the Field Description
This topic contains 12 replies, has 3 voices, and was last updated by Andy 5 years, 6 months ago.
We have moved to a support ticketing system and our forums are now closed.
Open Support TicketTagged: field description
-
AuthorPosts
-
September 12, 2019 at 8:38 am #507765
I would like to include a link in the Field Description so it shows to the user on the frontend add listing page.
This is for the post_content field for a CPT called “Listings”.
I have tried to simply include HTML in the Field Description but it gets stripped out.
This is somewhat similar to this thread from a couple of years ago:
https://wpgeodirectory.com/support/topic/custom-field-description/
The purpose is the same at least, to provide a link to further information to help the user understand what to do or what our policies are.
The solution suggested there is using translation files. I’ve found the docs about translation but it seems like overkill to achieve something pretty simple. Also seen the v1 filters but not sure if they are still the same in v2 and many are undocumented.
Would appreciate some advice on the best way to achieve this. A filter to stop the HTML getting stripped would be nice!
September 12, 2019 at 11:09 am #507795Hello,
yes, the Custom Field translation system is the way to do that.
https://wpgeodirectory.com/docs/translating-custom-fields/
The tool can now be found at
GD – Status – Tools
September 12, 2019 at 12:13 pm #507810OK, thank you.
It seems like a long and not intuitive way around to achieve it but it does work.
But I don’t like it from a maintainability point of view, so I would like to request from the devs that Field Description simply allows HTML – what is the right way to request that?
A couple of other questions, if you don’t mind…
As this isn’t a real translation I have left the language as en_US and put the resulting PO and MO files into \wp-content\languages\plugins. Will these get overwritten by a language pack update (mentioned in the docs)?
If the original Field Description string changes, will it stop picking up the translation?
Thanks again!
September 12, 2019 at 12:18 pm #507814My reply seems to have disappeared… if I try to post it again it says it is a duplicate. Maybe it has gone for moderation?
September 12, 2019 at 12:25 pm #507820I have taken this up as a suggestion and will share it with our development team to see whether we can work on this in the near future.
They can be overwritten. We have some info here about that: https://wpgeodirectory.com/docs-v2/translation/overview/#disable-auto-trans
Please feel free to make a new topic if you need help with anything else.
September 12, 2019 at 12:41 pm #507825The developers have added the support for anchor link HTML in description fields. It will be available in the next release.
September 12, 2019 at 12:52 pm #507826That’s great news, thanks!
September 17, 2019 at 4:28 pm #508653I can confirm that it is now possible to include links in the Field Description. Many thanks to Alex and the devs!
Sorry to be a pain, but the way it has been implemented strips out the target attribute. Being able to include target, and also class and id attributes would be very useful because:
1. target would allow you to open a page giving further instructions in a new window. If the instructions open in the same window, and the user has spent a while editing their inputs, they might get a shock and think their work has been lost.
2. class and id would allow further styling to be done easily, or to be able to hook on JS functions. This would allow the instructions to open in a pop-up over the page or an icon to be added, for example.
Thanks!
September 17, 2019 at 4:50 pm #508658I am checking with the developers about the details.
September 18, 2019 at 7:22 am #508874Hi Andy,
To allow id and class in a link replace wp_filter_kses with wp_kses_post in this line https://github.com/AyeCode/geodirectory/blob/master/includes/admin/settings/class-geodir-settings-cpt-cf.php#L1552
Kiran
September 18, 2019 at 8:06 am #508889Thanks Kiran. Is that change going to be made to the core?
September 18, 2019 at 8:16 am #508890This reply has been marked as private.September 18, 2019 at 10:26 am #508911Great, thanks. I can confirm that target, class and id attributes can now be set.
-
AuthorPosts
We have moved to a support ticketing system and our forums are now closed.
Open Support Ticket