Title: Using in template
Last modified: August 20, 2016

---

# Using in template

 *  Resolved [richleppard2](https://wordpress.org/support/users/richleppard2/)
 * (@richleppard2)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/using-in-template/)
 * Hi, great plugin, I worked out how to use it in template:
 *     ```
       <?php
   
       echo do_shortcode('[expand title="<h3>USA</h3>"]
   
       html content
   
       [/expand]');?>
       ```
   
 * However I’d like to know how to use a php include where the html would be ie:
   <?php include(/file.php);?>
 * My php is no good, can someone suggest something. The included file would also
   include php as I’m using the advanced custom fields plugin.
 * Thanks
 * [http://wordpress.org/extend/plugins/jquery-collapse-o-matic/](http://wordpress.org/extend/plugins/jquery-collapse-o-matic/)

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

 *  Plugin Author [Baden](https://wordpress.org/support/users/baden03/)
 * (@baden03)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/using-in-template/#post-3401519)
 * Explain more about what you mean by:
 * >  php include where the html would be
 *  Are you wanting to include content from a WordPress post, or load up one of 
   your theme’s templates? What does file.php do?
 *  Thread Starter [richleppard2](https://wordpress.org/support/users/richleppard2/)
 * (@richleppard2)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/using-in-template/#post-3401577)
 * In literal terms: where the above snippet says ‘html content’ I would want the
   equivalent of <?php include(includes/list.php);?>. The file this refers to would
   be an unordered list in html but each
    -  tag would contain <?php get_field(‘name’);?>.
    - My problem is I have no experience of inserting php within php. In the above
      example the expand tags are opened and closed but the space between them only
      seems to allow html.
    - Thanks for your response.
 *  Thread Starter [richleppard2](https://wordpress.org/support/users/richleppard2/)
 * (@richleppard2)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/using-in-template/#post-3401578)
 * Reposting as that may not be viewable.
 * In literal terms: where the above snippet says ‘html content’ I would want the
   equivalent of `<?php include(includes/list.php);?>` The file this refers to would
   be an unordered list in html but each would contain `<?php get_field('name');?
   >`
 * My problem is I have no experience of inserting php within php. In the above 
   example the expand tags are opened and closed but the space between them only
   seems to allow html.
 * Thanks for your response.
 *  Plugin Author [Baden](https://wordpress.org/support/users/baden03/)
 * (@baden03)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/using-in-template/#post-3401580)
 * Why are you using an external .php file for your content? Is it a template, or
   does the php file only contain static content? Do you have anyone that is more
   familiar with php to help you out? I think there is a much cleaner, simpler way
   to achieve what you are trying to accomplish.
 *  Thread Starter [richleppard2](https://wordpress.org/support/users/richleppard2/)
 * (@richleppard2)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/using-in-template/#post-3401585)
 * In fairness the external php file is just to keep tidy. However the content I
   want expanded needs to be a php handle so that I can link it to the backend of
   wordpress for the client to update. I’ll try stack overflow. It’s a bit of a 
   unique problem because the shortcode is specific to WordPress and the plugin 
   and so I’m not sure how it effects the syntax of php.
 * Thanks for your help.
 *  Plugin Author [Baden](https://wordpress.org/support/users/baden03/)
 * (@baden03)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/using-in-template/#post-3401586)
 * Let us know how you get it solved! So you do not give the client access to WordPress,
   just a php file that they will update/upload via FTP?!
 *  Thread Starter [richleppard2](https://wordpress.org/support/users/richleppard2/)
 * (@richleppard2)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/using-in-template/#post-3401587)
 * I use Advanced Custom Fields plugin. I create a custom field for them and then
   put the php get_field into the template. I find it works a charm but Ive never
   had to include such a call into another piece of php.
 *  Plugin Author [Baden](https://wordpress.org/support/users/baden03/)
 * (@baden03)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/using-in-template/#post-3401588)
 * Not sure if this will help, but you could try something like:
 *     ```
       <?php
       $field_name = get_field('name');
       include('includes/'.$field_name.'.php');
       ?>
       ```
   
 * But this is beyond the scope of our plugin. Best of luck!
 *  Thread Starter [richleppard2](https://wordpress.org/support/users/richleppard2/)
 * (@richleppard2)
 * [13 years, 4 months ago](https://wordpress.org/support/topic/using-in-template/#post-3401589)
 * Thanks (for the help and the plugin of course)

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

The topic ‘Using in template’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/jquery-collapse-o-matic_fffeff.svg)
 * [Collapse-O-Matic](https://wordpress.org/plugins/jquery-collapse-o-matic/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/jquery-collapse-o-matic/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/jquery-collapse-o-matic/)
 * [Active Topics](https://wordpress.org/support/plugin/jquery-collapse-o-matic/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/jquery-collapse-o-matic/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/jquery-collapse-o-matic/reviews/)

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)
 * [template](https://wordpress.org/support/topic-tag/template/)

 * 9 replies
 * 2 participants
 * Last reply from: [richleppard2](https://wordpress.org/support/users/richleppard2/)
 * Last activity: [13 years, 4 months ago](https://wordpress.org/support/topic/using-in-template/#post-3401589)
 * Status: resolved