Title: slider within PHP plugin template
Last modified: August 20, 2016

---

# slider within PHP plugin template

 *  Resolved [pinpoint](https://wordpress.org/support/users/pinpoint/)
 * (@pinpoint)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/slider-within-php-plugin-template/)
 * Hello,
    I’m trying to implement the plugin within the template of another plugin,
   and am hitting a brick wall. I read the various posts about implementing it within
   php, and I got those working, but here’s where I’m stuck. This page: [http://enterprizenetwork.com/?page_id=17](http://enterprizenetwork.com/?page_id=17)
   is called using the List-Category-Posts plugin, which uses its own template. 
   I want to implement the Collapse-o-matic so that clicking the title expands the
   content. The relevant line are ` $lcp_display_output .= ‘<h6 class=”entry-title”
   >’. $this->get_post_title($single); $lcp_display_output .= $this->get_content(
   $single, ‘p’, ‘lcp_content’);` Is what I”m trying to do possible? Any ideas? 
   Thanks
 * [http://wordpress.org/extend/plugins/jquery-collapse-o-matic/](http://wordpress.org/extend/plugins/jquery-collapse-o-matic/)

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

 *  Thread Starter [pinpoint](https://wordpress.org/support/users/pinpoint/)
 * (@pinpoint)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/slider-within-php-plugin-template/#post-3510812)
 * In case the above was unclear: the code I quoted is the code from the template,
   which variables I want to use as the expand title and content, respectively.
   
   Thanks for looking.
 *  Plugin Author [Baden](https://wordpress.org/support/users/baden03/)
 * (@baden03)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/slider-within-php-plugin-template/#post-3510943)
 * In this case, I would recommend you use the [roll-your-own method,](http://plugins.twinpictures.de/plugins/collapse-o-matic/documentation/#roll-your-own)
   rather than try to stuff all of this into a [do_shortcode](http://codex.wordpress.org/Function_Reference/do_shortcode)
   function in your template.
 * Something like this might work:
 *     ```
       $lcp_display_output .= '<h6 class="entry-title collapseomatic" id="com'.$this->ID.'">'. $this->get_post_title($single).'</h6>';
       $lcp_display_output .= '<div id="target-com'.$this->ID.'" class="collapseomatic_content">'.$this->get_content($single, 'p', 'lcp_content').'</div>';
       ```
   
 * Please let us know how that works out for you.
 *  Thread Starter [pinpoint](https://wordpress.org/support/users/pinpoint/)
 * (@pinpoint)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/slider-within-php-plugin-template/#post-3510997)
 * Definitely getting closer–the title seems to be correct now, but the content 
   isn’t appearing in the “collapseomatic_content” div.
    I really appreciate your
   taking the time to help with this! [http://enterprizenetwork.com/?page_id=17](http://enterprizenetwork.com/?page_id=17)
 *  Plugin Author [Baden](https://wordpress.org/support/users/baden03/)
 * (@baden03)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/slider-within-php-plugin-template/#post-3511042)
 * In your initial example, what exactly does
    `$this->get_content($single, 'p','
   lcp_content')` produce? On your page it is not returning anything at all. Are
   you sure you did not mean to use the WordPress function [get_the_content](http://codex.wordpress.org/Function_Reference/get_the_content)
   instead? Or, have you defined your own get_content function?
 *  Thread Starter [pinpoint](https://wordpress.org/support/users/pinpoint/)
 * (@pinpoint)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/slider-within-php-plugin-template/#post-3511048)
 * Being in slightly over my head (as I’m sure you can tell), I understand that 
   the bios are being produced by
    `$this->get_content($single, 'p', 'lcp_content')`
   With a little trial and error, I have it expanding and collapsing now, but for
   some reason instead of putting a unique ID on each post, every post triggers 
   the same person’s collapse! Here’s what I have:
 *     ```
       $lcp_display_output .= '<h6 class="entry-title collapseomatic" id="com'.$this->ID.'">'. $this->get_post_title($single).'</h6>';
           $lcp_display_output .= $this->get_custom_fields($this->params['customfield_display'], $single->ID);
       $lcp_display_output .= '<div id="target-com'.$this->ID.'" class="collapseomatic_content">'.$this->get_content($single, 'p', 'lcp_content').'</div>';
       ```
   
 * Thank you yet again
    [http://enterprizenetwork.com/?page_id=17](http://enterprizenetwork.com/?page_id=17)
 *  Plugin Author [Baden](https://wordpress.org/support/users/baden03/)
 * (@baden03)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/slider-within-php-plugin-template/#post-3511060)
 * The html that is being output looks like this:
 *     ```
       <h6 class="entry-title collapseomatic colomat-visited" id="">Alex Mashinsky</h6>
       ```
   
 * So basically the ID is not being defined at all. Not even com and target-com 
   are being used as the id, so you will want to verify that you really are using`
   id="com".$this->ID.'"`
 * Once the com and target-com are showing up, it will just be a matter of being
   sure that `$this->ID` actually returns something. You can do this by adding:
 *     ```
       var_dump($this->ID);
       ```
   
 * and checking that unique post id’s are being dumped for each collapse element.
 * This is as far as we can help you with this. If you still can not get it worked
   out, you might want to consider our very reasonable [premium support](http://plugins.twinpictures.de/plugins/collapse-o-matic/support/)
   offer.
 * Good luck!
 *  Plugin Author [Baden](https://wordpress.org/support/users/baden03/)
 * (@baden03)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/slider-within-php-plugin-template/#post-3511076)
 * OK, after looking at your page, it seems the correct way to use the ID would 
   be:
 *     ```
       $lcp_display_output .= '<h6 class="entry-title collapseomatic" id="com'.$single->ID.'">'. $this->get_post_title($single).'</h6>';
       $lcp_display_output .= '<div id="target-com'.$single->ID.'" class="collapseomatic_content">'.$this->get_content($single, 'p', 'lcp_content').'</div>';
       ```
   
 * Work for you?

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

The topic ‘slider within PHP plugin 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

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

 * 7 replies
 * 2 participants
 * Last reply from: [Baden](https://wordpress.org/support/users/baden03/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/slider-within-php-plugin-template/#post-3511076)
 * Status: resolved