Include a link in the Field Description

This topic contains 12 replies, has 3 voices, and was last updated by  Andy 4 years, 7 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #507765

    Andy
    Expired Member
    Post count: 46

    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!

    #507795

    Alex Rollin
    Moderator
    Post count: 27815

    Hello,

    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

    #507810

    Andy
    Expired Member
    Post count: 46

    OK, 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!

    #507814

    Andy
    Expired Member
    Post count: 46

    My reply seems to have disappeared… if I try to post it again it says it is a duplicate. Maybe it has gone for moderation?

    #507820

    Alex Rollin
    Moderator
    Post count: 27815

    I 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.

    #507825

    Alex Rollin
    Moderator
    Post count: 27815

    The developers have added the support for anchor link HTML in description fields. It will be available in the next release.

    #507826

    Andy
    Expired Member
    Post count: 46

    That’s great news, thanks!

    #508653

    Andy
    Expired Member
    Post count: 46

    I 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!

    #508658

    Alex Rollin
    Moderator
    Post count: 27815

    I am checking with the developers about the details.

    #508874

    Kiran
    Moderator
    Post count: 7069

    Hi 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

    #508889

    Andy
    Expired Member
    Post count: 46

    Thanks Kiran. Is that change going to be made to the core?

    #508890

    Kiran
    Moderator
    Post count: 7069
    This reply has been marked as private.
    #508911

    Andy
    Expired Member
    Post count: 46

    Great, thanks. I can confirm that target, class and id attributes can now be set.

Viewing 13 posts - 1 through 13 (of 13 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket