How to use a shortcodce in a Custom Field

This topic contains 5 replies, has 3 voices, and was last updated by  amstourist 9 years, 3 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #27728

    amstourist
    Expired Member
    Post count: 185

    Hello from Amsterdam!

    I want to use a shortcode in a Form Field. How can I do that?
    At this time the shortcode doesn’t work, it only shows the shortcode and not the searchbox that supposed to show up with that shortcode.

    Hope you can help me on this, because it’s an important item for the design and usage of my wesbite…..

    Cheers, Jan

    #27729

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    this is not possible. Personally I would add the shortcode to the template with a function.

    Thx

    #27731

    amstourist
    Expired Member
    Post count: 185

    Ho @paolo,

    Using a shortcode in template with a function doesn’t work for me. For every listing it’s a different shortcode…

    Is there any other option?
    A shortcode does work on the “Property Information” tab….

    Cheers, Jan

    #27780

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hi Jan,

    May i ask what this is for? And where exactly you want it?

    Stiofan

    #27828

    Paolo
    Site Admin
    Post count: 31206

    Hi,

    by default on wordpress, shortcode are only parsed in the content of the posts.

    They do not work in custom fields unless the function that displays them is wrapped in a do_shortcode() function, which is not the case with GD, because custom fields are dynamic and wrapping them all in do_shortcode by default would make the code redundant.

    I ask this to Stiofan, why don’t we add a shortcode ready custom field between the possible options?

    Let us know,

    Thx

    #27913

    amstourist
    Expired Member
    Post count: 185

    Thx Paolo!

    I’m using a plugin to search and book hotels on booking.com:
    https://wordpress.org/plugins/bookingcom-affiliate-plugin/

    It works with shortcodes, so I can make a hotel searchbox for each hotel. So I need that searchbox on one of the field options….

    But….. I think I found another solution. Just have to test it. There is another booking.com plugin:
    https://wordpress.org/plugins/bookingcom-official-searchbox/

    This plugin works with widgets. I have to set a widget area in a sidebar with this plugin (thats possible with WPGeodirectory) and specify a destination per post using meta Boxes.
    I think this would be even more easier for me….

    I’ll let you know if it works…

    But anyway many thx in advance for listening to me…. 😉
    Keep you posted if I still need a solution…

    Cheers, Jan

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

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

Open Support Ticket