Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @loukky

    Thank you for reaching out and I am happy to help!
    Can you please share if you have any <PHP> tags within the mfunc comment?
    Thanks!

    Thread Starter loukky

    (@loukky)

    this is my theme`s footer.php

    
    		</div><!-- .cv-container -->
    <!--
    if ( is_user_logged_in() ) {
        echo "<?php /* do_action( 'news_vibrant_footer' ); do_action('performance'); */?>"
    } else {
        echo "do_action( 'news_vibrant_footer' ); do_action('performance');";
    }-->
    <!-- mfunc dynamic_tips -->
    do_action( 'news_vibrant_footer' ); 
    do_action('performance');
    	<!-- /mfunc dynamic_tips -->
    </div><!-- #page -->
    <?php
        do_action( 'news_vibrant_after_page' );
    
        wp_footer();
    ?>
    
    </body>
    </html>

    and any other informations?

    Thread Starter loukky

    (@loukky)

    in fact.

    do_action( 'news_vibrant_footer' ); 
    do_action('performance');

    is i need to keep dynamic code.so i use mfunc to achieve this.
    but as you can see, i cant edit
    do_action( 'news_vibrant_footer' );
    in customize after i use mfunc replace <?php

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @loukky

    Thank you for the information.
    The solution is to not use wp functions/core in mfunc code.
    e.g. instead of
    do_action( ‘news_vibrant_footer’ );
    use
    render_my_news_vibrant_footer();
    Alternatively, there was an option to run after init and look for late init.
    Thanks!

    Thread Starter loukky

    (@loukky)

    How can achieve init? for example?
    Sorry i don’t understand wp function…

    Thread Starter loukky

    (@loukky)

    i think it`s because mfunc not support <?php ?> tage
    if i change to this

    <!-- mfunc dynamic_tips  -->
    <?php
     do_action( 'news_vibrant_footer' ); 
    do_action('performance');  
    ?>
    	<!-- /mfunc dynamic_tips -->

    wp error
    Parse error: syntax error, unexpected '<', expecting end of file in /www/wwwroot/loukky.com/wp-content/plugins/w3-total-cache/PgCache_ContentGrabber.php(1885) : eval()'d code on line 1

    • This reply was modified 4 years, 8 months ago by loukky.
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @loukky

    Yes, you are correct. You should not use PHP tags within the <!-- mfunc -->
    Are you able to edit if you remove the mfunc wrap?
    Thanks!

    Thread Starter loukky

    (@loukky)

    hello @vmarko
    if i remove the mfunc wrap,
    that to be

    <?php
     do_action( 'news_vibrant_footer' ); 
    do_action('performance');  
    ?>

    i can edit because this is the footer.php original code…
    so i want to keep can edit and the same time is dynamic…

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @loukky

    Thank you for your patience.
    WE’ve tested this with the theme you are using and once the Page Fragment Cache is set up correctly, the edit icons are there and work as expected.
    Make sure to add define( 'W3TC_DYNAMIC_SECURITY', 'dynamic_tips' ); to wp-config.php, switch Page cahing method to Disk: Basic and enable late initialization.
    Also, make sure that the pages are not cached for logged-in users and make sure to purge the cache.
    Thanks!

    Thread Starter loukky

    (@loukky)

    hello @vmarko
    i do them all ,not working….
    i dont know why

    Thread Starter loukky

    (@loukky)

    i test on local site .. its not work either
    dont use mfunc code:
    https://imgur.loukky.com/imgs/2021/09/31575c7973c03a0c.png
    after use mfunc code:
    https://imgur.loukky.com/imgs/2021/09/eeef2701cd0ff5f0.png

    • This reply was modified 4 years, 8 months ago by loukky.
    • This reply was modified 4 years, 8 months ago by loukky.
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @loukky

    Thank you for the information.
    In this case, the only solution is to remove the <!– mfunc –> comment, make your edit, and then again wrap the desired content with <!– mfunc –>
    Thanks!

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘how can use /mfunc to if else <?php’ is closed to new replies.