• My pages are built via Gutenberg blocks. I have used shortcode blocks and need to cache my pages, except blocks where I’m pulling in stock prices and announcements. these are embedded in the content via Gutenberg shortcode blocks.

    I was able to exclude a shortcode block in the header template like so:

    <!–mfunc myprivatekey –>
    echo do_shortcode(‘some_shorty’);
    <!–/mfunc myprivatekey –>

    but I can’t figure out how to do this from inside actions and shortcodes in my functions file. whenever I try, the page just dies. anyone got any ideas?

    The page I need help with: [log in to see the link]

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

    (@vmarko)

    Hello @binarypusher

    Thank you for reaching out and I am happy to assist you with this.
    As you mentioned, this was successful in when the shortcode was excluded in the header template.
    This should be the same for any other template. The comment/code blocks should be added to your theme template files as HTML and not within the PHP open (<?php) and close (?>) tags, as it will cause a PHP parse error/syntax error.
    Please make sure to check more details in our FAQ page.

    I hope this helps!

    Thanks!

    Thread Starter binarypusher

    (@binarypusher)

    Hi Marko,

    Thanks very much for taking the time to respond.when I say blocks, I mean Gutenberg blocks. my entire page content layout is handled with the Gutenberg block editor. I’m only able to modify the template for header items. all my content is from the_content(); and my footer items are widgets within the footer.

    so, in my Gutenberg blocks, I’m using the shortcode Gutenberg block to add some custom code to pages. is it that I can only exclude items at the template level? I’d like to be able to exclude functions within my functions.php file.

    does that make my query clearer?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @binarypusher

    Thank you for yoru feedback and the clarification.
    Let me get back to you on this.
    Thank you for your patience.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘how to use mfunc cache exclusion within a block or shortcode or function’ is closed to new replies.