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 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
-
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.In this case, I would recommend you use the roll-your-own method, rather than try to stuff all of this into a 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.
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=17In 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 instead? Or, have you defined your own get_content function?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=17The 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->IDactually 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 offer.
Good luck!
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?
The topic ‘slider within PHP plugin template’ is closed to new replies.