Short Code in html field

This topic contains 6 replies, has 4 voices, and was last updated by  Stiofan O’Connor 6 years, 11 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #379988

    Jennie McNichol
    Full Member
    Post count: 76

    Hi I have placed a html field on the listing page which is located in my tab section that I would like to add short code into but it doesn’t appear to work. It works absolutely fine in the profile description box but not when I place it into the html field. Is there anything I can do to get it to work?

    #380028

    Kor
    Moderator
    Post count: 16516
    #380226

    Lance Sampson
    Buyer
    Post count: 108

    Hi

    I used the code below to code snippets and created an HTML custom field to output 3rd party shortcode. It only shows the raw short code versus the output.

    function my_enable_shortcodes_in_cf($html,$location,$cf){

    // this line will enable it for all text inputs
    $html = do_shortcode( $html );
    return $html;
    }
    add_filter(‘geodir_custom_field_output_text’,’my_enable_shortcodes_in_cf’,15,3);

    Here is the code its show: [yelp-widget-pro id=”advantage-storage-garland-garland” align=”left” cache=”None”]

    It works total fine in the profile description field.

    Any suggestions?

    Best Regards,

    #380271

    Jennie McNichol
    Full Member
    Post count: 76

    The suggested code is not working for me either. Is there anyway of having a duplicate ‘profile field’?

    #380295

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Each field type requires a different hook
    add_filter(‘geodir_custom_field_output_text’,’my_enable_shortcodes_in_cf’,15,3);
    add_filter(‘geodir_custom_field_output_textarea’,’my_enable_shortcodes_in_cf’,15,3);

    So this should cover text AND textarea fields

    
    
    
    function my_enable_shortcodes_in_cf($html,$location,$cf){
      
        // this line will enable it for all text inputs
        $html = do_shortcode( $html );
        return $html;
    }
    add_filter('geodir_custom_field_output_text','my_enable_shortcodes_in_cf',15,3);
    add_filter('geodir_custom_field_output_textarea','my_enable_shortcodes_in_cf',15,3);

    Thanks,

    Stiofan

    #380383

    Lance Sampson
    Buyer
    Post count: 108

    Stiofan,

    Works like a charm!

    Thanks again for all your help!

    Best Regard,

    #380385

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    🙂

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

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

Open Support Ticket