Title: Mfunc does not work with slideshow
Last modified: August 20, 2016

---

# Mfunc does not work with slideshow

 *  [erikhgm](https://wordpress.org/support/users/erikhgm/)
 * (@erikhgm)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/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](http://pastebin.com/HLhMwXPY)

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

 *  [tgeorge](https://wordpress.org/support/users/tgeorge/)
 * (@tgeorge)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/mfunc-does-not-work-with-slideshow/#post-2275414)
 * 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](http://wordpress.org/support/topic/dynamic-content-1?replies=3#post-2317713)
 *  Thread Starter [erikhgm](https://wordpress.org/support/users/erikhgm/)
 * (@erikhgm)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/mfunc-does-not-work-with-slideshow/#post-2275421)
 * I removed the php tags and changed to mfunc and now the code looks like this:
   [http://pastebin.com/kL96tswa](http://pastebin.com/kL96tswa)
 * and I have aslo tried this code: [http://pastebin.com/pXCSg5yt](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
 *  [tgeorge](https://wordpress.org/support/users/tgeorge/)
 * (@tgeorge)
 * [14 years, 9 months ago](https://wordpress.org/support/topic/mfunc-does-not-work-with-slideshow/#post-2275424)
 * 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 Contributor [Frederick Townes](https://wordpress.org/support/users/fredericktownes/)
 * (@fredericktownes)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/mfunc-does-not-work-with-slideshow/#post-2275625)
 * 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.

 * ![](https://ps.w.org/w3-total-cache/assets/icon-256x256.png?rev=1041806)
 * [W3 Total Cache](https://wordpress.org/plugins/w3-total-cache/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/w3-total-cache/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/w3-total-cache/)
 * [Active Topics](https://wordpress.org/support/plugin/w3-total-cache/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/w3-total-cache/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/w3-total-cache/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [Frederick Townes](https://wordpress.org/support/users/fredericktownes/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/mfunc-does-not-work-with-slideshow/#post-2275625)
 * Status: not resolved