b2evolution b2evolution

  • Sign in
  • Sign up
  • About
  • Downloads
  • Hosting
  • Docs
  • Support
  • Sign in
  • Sign up
  • Manuals Home
  • Latest Updates
 
  1. b2evolution CMS User Manual
  2. Developer Reference
  3. How to... (Customize)
  4. Display Recent Posts In The Sidebar

Display Recent Posts In The Sidebar

b2evo 2.x and above

Using the widgets system, you should add to your sidebar container a Post list widget. In 3.x series you can use the Simple Post list widget to include the recent posts from the blog itself, and the Universal Items List widget to include recent posts from another blog.

before b2evo 2.x

The easiest method to accomplish this is the use the Sideblog plugin, which works in b2evolution 1.6 and up.

All the code in this examples shows the title with a link to the post, but also the content itself is a link

Show the latest post from categoy 5 in blog 3


<div class="bSideItem">
	<?php $BlogBList = & new ItemList( 3,  '', '', '', '', '', array(5), '', 'DESC', '', 1, '', '', '', '', '', '', '', 'posts' );
	while( $Item = $BlogBList->get_item() )	{ ?>
	<strong><?php $Item->permanent_link('#title#'); ?></strong>
	<div style="cursor:pointer" onclick='window.location="<?php echo $Item->get_permanent_url(); ?>"'>
		<?php $Item->content(1,false,'#','#','#','#','htmlattr'); ?>
	</div>	
	<?php }  ?>		
</div>	

Show the latest post from category 7,37,38,39 in blog 3 (ideal if you use subcategories)


<div class="bSideItem">
	<?php $BlogBList = & new ItemList( 3,  '', '', '', '', '', array(7,37,38,39), '', 'DESC', '', 1, '', '', '', '', '', '', '', 'posts' );
	while( $Item = $BlogBList->get_item() )	{ ?>
	<strong><?php $Item->permanent_link('#title#'); ?></strong>
	<div style="cursor:pointer" onclick='window.location="<?php echo $Item->get_permanent_url(); ?>"'>
		<?php $Item->content(1,false,'#','#','#','#','htmlattr'); ?>
	</div>	
	<?php }  ?>		
</div>

Show the latest post from blog 5, whatever category


<div class="bSideItem">
	<?php $BlogBList = & new ItemList( 5,  '', '', '', '', '', array(), '', 'DESC', '', 1, '', '', '', '', '', '', '', 'posts' );
	while( $Item = $BlogBList->get_item() )	{ ?>
	<strong><?php $Item->permanent_link('#title#'); ?></strong>
	<div style="cursor:pointer" onclick='window.location="<?php echo $Item->get_permanent_url(); ?>"'>
		<?php $Item->content(1,false,'#','#','#','#','htmlattr'); ?>
	</div>	
	<?php }  ?>		
</div>
Created by fatimahnasra • Last edit by fplanque on 2020-06-09 00:24 • •

No feedback yet

On this page

  • b2evo 2.x and above
  • before b2evo 2.x
  • Show the latest post from categoy 5 in blog 3
  • Show the latest post from category 7,37,38,39 in blog 3 (ideal if you use subcategories)
  • Show the latest post from blog 5, whatever category

Search the Manual

Content Hierarchy

  • b2evolution CMS User Manual
  • User's Guide
  • Installation / Upgrade
  • Front-office Reference
  • Back-office Reference
  • Developer Reference
    • Website Skins/Themes
    • Email Skins/Themes
    • b2evolution Files
    • Website Integration
    • Plugins
    • Debugging
    • Technical Reference
    • Hacks
    • Credits
    • Development
    • How to... (Customize)
      • How to upgrade a b2evo blog template to an evoSkin
      • Popup Comments
      • FTP 101: How to upload and manage files on your web server
      • Working with the Open Graph Protocol
      • How to - Use "honeypots" in your forms
      • I made a change but my blog is not updated
      • Turn A Skin Into A Template
      • Where is the Templates Tab?
      • Display Recent Posts In The Sidebar
      • Recent Comments In The Sidebar
      • Include Item Feedback
      • How to display comments, trackbacks and pingbacks UNMIXED
      • Change the way my blog looks
      • How to use b2evolution as a CMS
      • How to Show the Assigned Author of a post
      • How to change the "Read More" link
      • How to call a blog through xyz.php instead of index.php?blog=x
      • How to turn a Skin into a Template
      • How To use Pop-Up Comments in your evoSkin
      • How to add a smilie to your toolbar
      • How to display the posts' author
      • Dev Menu
    • Scheduled Tasks Reference
  • Operations Reference
  • Advanced Topics
  • Glossary
  • Archives
Open Source CMS

This online manual is powered by b2evolution CMS – A complete engine for your website.

About b2evolution

  • What is it?
  • Features
  • Getting Started
  • Screenshots
  • Online demo
  • Testimonials
  • Design philosophy
  • Free & open source
  • Terms of service

Downloads

  • Latest releases
  • Skins
  • Plugins
  • Language packs

About us

  • About us
  • Contact

Webhosting Guide

  • Web hosting blog
  • Best web hosting
  • Cheap web hosting
  • Green web hosting
  • Hosting with SSH
  • VPS hosting
  • Dedicated servers
  • Reseller hosting
  • Int'l: UK / France

Docs & Support

  • Online manual
  • Forums
  • Hire a pro !

Other

  • Adsense
  • Press room
  • Privacy policy

Stay in touch

  • GitHub
  • Twitter
  • Facebook
  • LinkedIn
  • News blog
  • RSS feed
  • Atom feed

Founded & Maintained by François Planque