2nd HTML Field Shortcode

This topic contains 4 replies, has 3 voices, and was last updated by  Kiran 6 years ago.

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

Open Support Ticket
  • Author
    Posts
  • #452604

    banned
    Expired Member
    Post count: 14

    Hi,

    I already have a HTML form field (admin only) executing shortcode… with this in snippets:

    
    
    add_filter('geodir_show_geodir_shortcode','enable_shortcodes_on_field',10,2);
    function enable_shortcodes_on_field($html, $variables_array){
       return apply_filters('the_content', $html);
    }

    Question: How to add another one? (the new variable name is “corrections” – it’s a contact form for errors/corrections on the listing displayed as a tab)

    Thanks!!

    #452636

    Paolo
    Site Admin
    Post count: 31206

    this should do it:

    add_filter('geodir_show_geodir_HTMLVAR','enable_shortcodes_on_field',10,2);

    change HTMLVAR

    #452639

    banned
    Expired Member
    Post count: 14

    thank you… I had tried that already… I’m not well versed on exactly how / where it should go… I tried adding this:

    
    
    add_filter('geodir_show_geodir_shortcode','enable_shortcodes_on_field',10,2);
    add_filter('geodir_show_geodir_corrections','enable_shortcodes_on_field',10,2);
    function enable_shortcodes_on_field($html, $variables_array){
       return apply_filters('the_content', $html);
    }

    by editing what is already there in snippets, but it didn’t work. I tried copying it exactly, but just changing the variable name, but that didn’t work either.

    #452641

    Paolo
    Site Admin
    Post count: 31206

    Sorry about that, what you did looks correct to me too.

    A developer has been alerted and they’ll look at this as soon as they come back online later.

    Thanks for your patience,

    #452681

    Kiran
    Moderator
    Post count: 7069

    Hello,

    Use following code snippet to use shortcode in custom field. If this is not working then provide us admin & FTP credentials in a private reply to look into.

    
    
    function gd_snippet_shortcode_in_custom_field( $html, $location, $field ) {
        if ( $html ) {
    		$html = do_shortcode( $html );
    	}
    
        return $html;
    }
    add_filter( 'geodir_custom_field_output_html', 'gd_snippet_shortcode_in_custom_field', 100, 3 );
    add_filter( 'geodir_custom_field_output_text', 'gd_snippet_shortcode_in_custom_field', 100, 3 );
    add_filter( 'geodir_custom_field_output_textarea', 'gd_snippet_shortcode_in_custom_field', 100, 3 );

    Thanks,
    Kiran

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

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

Open Support Ticket
20% Discount Offer
Hurry! Get your 20% discount before it expires. Get 20% Discount