fanchrobin777
Forum Replies Created
-
OK then :
1. Your template MUST be placed in a folder named list-category-posts inside your theme folder, as the plugin will look after the template file in this location and nowhere else. I guess for you it’s :
https://www.caribbeansailingschool.net/wp-content/themes/cushy/list-category-posts/myownpostlist.php2. The error probably comes from the fact that you should not close the php tag (my error):
<?php $lcp_display_output = ''; $lcp_display_output .= '<ul>'; foreach ($this->catlist->get_categories_posts() as $single): $lcp_display_output .= '<li>'; $lcp_display_output .= '<h1>'.$this->get_post_title($single).'</h1>'; $lcp_display_output .= $this->get_thumbnail($single); $lcp_display_output .= $this->get_excerpt($single, 'p', 'your p style'); $lcp_display_output .= '<br /><a href="'.get_permalink($single->ID).'">Read more</a>'; $lcp_display_output .= '</li>'; endforeach; $lcp_display_output .= '</ul>'; $this->lcp_output = $lcp_display_output;
See above : the last
?>
is not here anymore. (Close the <h1> tag too if you do use it, as I have made the mistake in my previous message :$lcp_display_output .= '<h1>'.$this->get_post_title($single).'</h1>';
)
Try this.3. When adding the shortcode to your page, you should not add additional parameters that override the functions you have defined in your template. For example, if you write in your template
$lcp_display_output .= $this->get_excerpt($single);
you do not have to addexcerpt=yes
into the shortcode syntax.Hope it helps.
Hi, you have to put it in a template. See template system in ‘other notes’ section of the plugin page. A template is a php file that tells the plugin how to list your posts. For example, you choose to display title, excerpt, featured image and a ‘read more’ link for each post.
1. Create a folder named list-category-posts in your theme folder.
2. Create a php file named myownpostlist.php inside this folder
3. Add this code :<?php $lcp_display_output = ''; $lcp_display_output .= '<ul>'; foreach ($this->catlist->get_categories_posts() as $single): $lcp_display_output .= '<li>'; $lcp_display_output .= '<h1>'.$this->get_post_title($single).'<h1>'; $lcp_display_output .= $this->get_thumbnail($single); $lcp_display_output .= $this->get_excerpt($single, 'p', 'your p style'); $lcp_display_output .= '<br /><a href="'.get_permalink($single->ID).'">Read more</a>'; $lcp_display_output .= '</li>'; endforeach; $lcp_display_output .= '</ul>'; $this->lcp_output = $lcp_display_output; ?>
Of course you can style each element by adding class parameters relating to your CSS, etc.
Then in the page where you want to display your post list, just add the shortcode which must contain the call to the template file like this :
[catlist id=your-cat-id template=myownpostlist]
Good luck.OK if anybody’s interested, it’s :
$lcp_display_output .= '<a href="' . get_permalink($single->ID).'">Read more</a>';
This happened after upgrading from v2.0 to 2.0.2
I just went back to version 2.0 and everything’s fine. Although I’d like to upgrade to the latest version, as I read on the author’s website version 2.0 is buggy. Any advice welcomed ! Thanks