Forum
Blog Recent Posts Sidebar Widget
Hi,
I'm trying to make a Recent Posts widget. I've tried using perch_blog_custom and it works fine on a single post page and the first page of any archive. However once I go to any subsequent pages it disappears.
<div class="subMenu subMenuBlog">
<!-- All Posts -->
<h3 class="all-posts"><a href="/blog">All Posts</a></h3>
<!-- Recent Posts (5) -->
<?php perch_blog_custom(array(
'sort' => 'postDateTime',
'count'=>5,
'sort-order'=>'DESC',
'template'=>'blog/recent_posts_widget.html'
));?>
<!-- By category listing -->
<?php perch_blog_categories(); ?>
<!-- By tag -->
<?php perch_blog_tags(); ?>
<!-- By year and then month -->
<?php perch_blog_date_archive_months(); ?>
</div>
recent_posts_widget.html is just a cut down version of post_in_list.html
<perch:before>
<ul class="hfeed listing"></perch:before>
<li class="hentry">
<h2><a href="<perch:blog id="postURL" />" rel="bookmark" class="entry-title"><perch:blog id="postTitle" /></a></h2>
<p class="entry-published date"><perch:blog id="postDateTime" format="%d %B %Y" /> • Comments: <perch:blog id="postCommentCount"/></p>
<perch:if exists="image"><img src="<perch:blog id="image" type="image" />" alt="<perch:blog id="postTitle" />" /></perch:if>
<perch:if exists="embed_display">
<perch:else />
<perch:if exists="embed">
<div class="post-stream-embed">
<perch:blog id="embed" type="textarea" label="Media" required="false" html="true" />
</div>
</perch:if>
</perch:if>
<div class="description entry-summary">
<perch:blog id="excerpt" type="textarea" textile="true" />
<p class="read-more"><a href="<perch:blog id="postURL" />" rel="bookmark">Read More ></a></p>
</div>
</li>
<perch:after>
</ul>
<perch:if exists="paging">
<div class="paging">
<span class="page-count">Page <perch:blog id="current_page" /> of <perch:blog id="number_of_pages" /></span>
<perch:blog id="page_links" encode="false" />
<perch:if exists="not_first_page">
<a href="<perch:blog id="prev_url" encode="false" />">< Previous</a>
</perch:if>
<perch:if exists="not_last_page">
<a href="<perch:blog id="next_url" encode="false" />">Next ></a>
</perch:if>
</div>
</perch:if>
</perch:after>
Diagnostics:
Perch: 3.0.14, PHP: 7.0.29, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: b5c5906d452ec590732a93b051f3827e02749b83 $, with PDO
Server OS: Linux, cgi-fcgi
Installed apps: content (3.0.14), assets (3.0.14), categories (3.0.14), perch_blog (5.6.1), perch_events (1.9.5)
App runtimes: <?php $apps_list = [ 'perch_events', 'perch_blog', ]; include(PERCH_PATH.'/addons/apps/kirk_email_obfuscator/runtime.php');
PERCH_LOGINPATH: /perch
PERCH_PATH: /home/creator_desousa/dancing-tao4/perch
PERCH_CORE: /home/creator_desousa/dancing-tao4/perch/core
PERCH_RESFILEPATH: /home/creator_desousa/dancing-tao4/perch/resources
Image manipulation: GD Imagick
PHP limits: Max upload 64M, Max POST 65M, Memory: 90M, Total max file upload: 64M
F1: 3b606135b33e6a102526838f4152a807
Resource folder writeable: Yes
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
REQUEST_URI: /perch/core/settings/diagnostics/
DOCUMENT_ROOT: /home/creator_desousa/dancing-tao4
HTTP_HOST: www.dancing-tao4.creator-design.co.uk
How can I create a Recent Posts widget that persists across paginated page?
Thanks.
Presumably you have it responding to the same
page=
argument on the URL. Try turning paging off for your widget.Hi Drew,
Thanks for the reply. Works fine now. I didn't see the paginate option in the perch_blog_custom function documentation.