Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
    Posts
  • #1324692

    Hello,
    I have a page using ‘Code Block’ element. I notice that ALB code ([av_heading …], [av_hr …], etc) works fine when I put it directly into Code Block element. But when I put this code into a function, alb code are not processed. Same issue with Code Block or Text Box.
    For example, I use a shortcode WPUF plugin with the following syntax : [wpuf_profile type=”profile” id=”1454″]. I would like to fill in ‘Id’ parameter with variable value like this $CodeBlock=‘[wpuf_profile type=”profile” id=”’.$id.’”]’. Moreover, I would like to use specific alb code depending on id value.
    Could you please give me some examples or the right syntax to apply ?
    Kind regards
    Jorge

    • This topic was modified 3 years, 2 months ago by liliwow.
    #1324863

    Hey Jorge,

    Thank you for the inquiry.

    Where are you planning to get the value of the $id parameter, or how would you assign it to the shortcode? You may need to create a custom shortcode instead of directly using the code block element. For more info about custom shortcodes or its API, please check the following documentation.

    // https://codex.wordpress.org/Shortcode_API

    Best regards,
    Ismael

    #1324870

    Hi Ismael,
    Obviously, my explanation was not so clear. Sorry for that.
    My main request is about ALB elements using inside a CodeBlock element. ALB code ([av_heading …], [av_hr …], etc) works fine when I put it directly inside a Code Block element. But when I put same code into a function called by a custom shortcode, alb code are not processed. Why ? Same issue with Code Block or Text Box.
    Thank you for help.
    Regards
    Jorge

    #1324879

    Hey!

    Thank you for the clarification.

    You may need use the avf_alb_exec_sc_only filter and allow execution of shortcodes that were not added directly in the ALB. Please add this in the functions.php file.

    function avf_custom_exec_sc_only_mod( $exec_sc_only, $obj_sc, $atts, $content, $shortcodename, $fake ) {
    	return true;
    }
    
    add_filter( 'avf_alb_exec_sc_only', 'avf_custom_exec_sc_only_mod', 10, 6 );
    

    Or this..

    add_filter( 'avf_alb_exec_sc_only', '__return_true' );
    

    Regards,
    Ismael

    #1324920

    Hi Ismael,
    Thank you for your prompt response. I added in the functions.php file the avf_alb_exec_sc_only filter to allow execution of shortcodes. I used both syntaxes but with no success. Content returned by my custom function is displaying as text.
    Any additional changes on CodeBlock element attributes (Code Wrapper Element, Action with codeblock, Escape HTML Code, Disable Shortcode Processing, Deactivate schema.org markup, etc) ?
    Regards
    Jorge

    My custom function :

    // Using the avf_alb_exec_sc_only filter to enable execution of shortcodes that are no longer within the
    add_filter( ‘avf_alb_exec_sc_only’, ‘__return_true’ );

    function DisplayProfileFields() {
    return (”
    [av_heading heading='Profile' tag='h2' style='blockquote modern-quote' subheading_active='' show_icon='' icon='ue800' font='entypo-fontello' size='' av-medium-font-size-title='' av-small-font-size-title='' av-mini-font-size-title='' subheading_size='' av-medium-font-size='' av-small-font-size='' av-mini-font-size='' icon_size='' av-medium-font-size-1='' av-small-font-size-1='' av-mini-font-size-1='' color='' custom_font='' subheading_color='' seperator_color='' icon_color='' margin='' margin_sync='true' padding='10' icon_padding='10' headline_padding='' headline_padding_sync='true' link='' link_target='' id='' custom_class='' template_class='' av_uid='av-kpazwmnd' sc_version='1.0' admin_preview_bg=''][/av_heading]
    “);
    return;
    }
    add_shortcode(‘liliDisplayProfileFields’, ‘DisplayProfileFields’);

    • This reply was modified 3 years, 2 months ago by liliwow.
    #1325191

    Hi,

    Thank you for following up.

    It is not working because you are returning the shortcode as an actual text. You have to wrap the shortcode in the do_shortcode function.

    // https://developer.wordpress.org/reference/functions/do_shortcode/

    Example:

    return do_shortcode("alb shortcode here");
    

    Best regards,
    Ismael

    #1326248

    Hi Ismael,

    Firstly, I would like to thank you a lot for your help. I’m using now the do_shortcode function. It’s works fine now.

    Therefore, I still have 2 issues :
    1. text with accent does not work (French). Any function to solve the issue ?
    2. GoogleMaps element does not work for some reason. Could you please tell me what is wrong with my code ?

    Please find below my code wrapped in the do_shortcode function :

    function GetGoogleMapsData() {
    $content=”[av_google_map zoom_control='aviaTBzoom_control' maptype_control='' streetview_control='aviaTBstreetview_control' zoom='16' maptype_id='' height='350px' saturation='-50' hue='' google_link='' confirm_button='Cliquez pour charger Google Maps' page_link_text='Ouvrir Google Maps dans une nouvelle fenetre' google_fallback='' attachment='' attachment_size='' id='' custom_class='' template_class='' av_uid='' sc_version='1.0']
    [av_gmap_location address='64, Rue de Commerce' postcode='75015' city='paris' state='' country='' long='2.2946935' lat='48.84575' marker='' imagesize='40' av_uid='' sc_version='1.0']
    [/av_gmap_location]
    [/av_google_map]“;
    return do_shortcode($content);
    }
    add_shortcode(‘liliGetGoogleMapsData’, ‘GetGoogleMapsData’);

    Best regards

    Jorge

    #1326256

    Hi,

    Glad to know that it is now working. Have you tried using the templates or the custom element templates features? This should allow you to create an element with predefined options based on the default elements in the builder.

    Please check the following documentation for more info.

    // https://kriesi.at/documentation/enfold/custom-element-templates/

    If you have any additional questions at this time we kindly ask that you open them up in a separate thread. The longer threads get in the forum, they become more difficult to support as they tend to drift off topic and they also make it troublesome for users trying to search for solutions. Keeping threads relevant to their original inquiry ensures that we can keep better track of what has been resolved and that users can more effectively find answers to similar issues they might be experiencing.

    Thanks!

    Best regards,
    Ismael

    #1326282

    Hi Ismael,

    I do not see the connection with my 2 issues and your document related to Custom Element Templates :

    1. text with accent does not work (French language)
    2. GoogleMaps element does not work

    How can I solve my problems encountered ? Should I fix my issues with CET ? I do not think so.

    Many thanks for your help.

    Best regards

    Jorge

    #1326308

    Hi,

    Because it looks you are trying to create custom shortcodes to render elements with predefined options. You can do the same with the Custom Elements Templates or the Templates option. Please open new threads for the new issues.

    Best regards,
    Ismael

    #1326398

    Hi Ismael,

    Thank you for your feedback. Let me have a look on Custom Elements Templates or the Templates options and I will let you know. By the way, what about accent issues ?

    Best regards

    Jorge

    #1326590

    Hi,

    Again, we kindly ask that you open another thread for new inquiries. This is to keep the thread relevant to the original topic and it will also make it easier for other users who might be looking for the same answer. We also recommend opening a single thread for each inquiry.

    Thank you for your understanding.

    Best regards,
    Ismael

    #1335001

    Hi Ismael,
    Please close this topic.
    Kind regards
    Jorge

    #1335031

    Hi,

    Thanks for letting us know, I’ll go ahead and close this thread for now then. Please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 14 posts - 1 through 14 (of 14 total)
  • The topic ‘Code Block usage’ is closed to new replies.