Tagged: 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #338137

    Hi,
    When I add a PHP code snippet into an Avia code block it doesn’t get executed because Avia somehow converts PHP code into a HTML comment markup. Why so?

    Input:

    [av_codeblock wrapper_element='' wrapper_element_attributes='' custom_class='']
    <div class="white-popup mfp-hide" id="plan-popup">
    ...
    [av_row row_style='avia-heading-row'][av_cell col_style='']Individual Plan[/av_cell][av_cell col_style='']Business Plan[/av_cell][/av_row]
    [av_row row_style='avia-pricing-row'][av_cell col_style='']<strong><?php print(get_field('price_individual', get_the_ID())); ?></strong>$<small>per month</small>[/av_cell][av_cell col_style='']<?php print(get_field('price_business', get_the_ID())); ?>$<small>per month</small>[/av_cell][/av_row]
    ...
    </div>
    [/av_codeblock]

    Output:

    ...
    <li class="avia-pricing-row"><!--?php print(get_field('price_individual', get_the_ID())); ?--><span class="currency-symbol">$</span><small>per month</small></li>
    ...
    • This topic was modified 10 years ago by epresley.
    #338672

    Hi epresley!

    Please try using this plugin – https://wordpress.org/plugins/insert-php/

    Best regards,
    Yigit

    #339290

    Now it looks as follows:
    Output:
    <li class="avia-pricing-row">[insert_php] print(get_field('price_individual', get_the_ID())); [/insert_php]

    It still doesn’t process PHP code and I did not disable shortcode processing…
    Besides: I use another plugin called ExecPHP which also executes PHP code snippets and it all works except inside an avia codeblock…

    #339651

    Hi!

    Have you tried using Text Block element instead?

    Best regards,
    Yigit

    #340469

    Yes, I have. Just inside a text block it gets executed but as soon as this one is wrapped into an avia code block the shortcode doesn’t get executed.

    #340471
    This reply has been marked as private.
    #340897

    Hi!

    Thank you for the update.

    You can’t use php codes inside the code block element and shortcodes are not recommended as you can see on the note:

    Enter some text/code. You can also add plugin shortcodes here. (Adding theme shortcodes is not recommended though)
    

    The get_field function is not a native theme function. Did you get this from advance custom fields plugin? Please contact the plugin author regarding the issue. I’m sorry but we don’t provide support for third party plugins.

    Regards,
    Ismael

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.