Support » Plugin: W3 Total Cache » Mfunc does not work with slideshow

  • I am trying to make a dynamic slideshow in the header and figured I could use the mfunc functionallty to prevent the slideshow from being cached.
    But mfunc does not work. I get a “Unable to open file:/…” error
    This is the code:
    http://pastebin.com/HLhMwXPY

Viewing 4 replies - 1 through 4 (of 4 total)
  • You mention “mfunc” (which is the right directive), but in the actual code, you’ve used “mclude” (which is a different directive). “mclude” is for loading external PHP files, like so:

    <!-- mclude -->path/to/file.php<!-- /mclude -->

    That’s why you’re getting an “Unable to open file” error. I replied with more details in your other thread :

    http://wordpress.org/support/topic/dynamic-content-1?replies=3#post-2317713

    I removed the php tags and changed to mfunc and now the code looks like this: http://pastebin.com/kL96tswa

    and I have aslo tried this code: http://pastebin.com/pXCSg5yt

    I get this error code now its driving me crazy now nothing seems to be working

    Unable to execute code: $args = array( ‘numberposts’ => 1, ‘orderby’=> ‘rand’, ‘category’ => 34 ); $rand_posts = get_posts( $args ); foreach( $rand_posts as

    Well, there are still five <?php...?> tags in your “mfunc” code. Also, removing the <?php...?> tags is not as simple as deleting them. You also need to isolate the HTML tags, by putting them inside echo(...); functions.

    For example, original line :

    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h5>

    will become :

    echo('<a href="'); the_permalink(); echo('">'); the_title(); echo('</a></h5>');

    Sorry, but I don’t have time to rewrite the entire code for you. You should be able to do it by yourself, by following the example I gave. Once you’re finished, the entire section should look this :

    <?php
    <!-- mfunc -->
    ...
    <!-- /mfunc -->
    ?>
    Plugin Author Frederick Townes

    (@fredericktownes)

    If your slideshow is dependent on WP itself it won’t work in this way because W3TC runs before WP is loaded.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Mfunc does not work with slideshow’ is closed to new replies.