How to display popular or latest posts on fishpig wordpress/magento

Latest posts into sidebar fishpig wordpress/magento
Last updated on

I will help you display latest/ recent posts of Fishpig extension into sidebar blog (or somewhere).

If you have installed Fishpig extension for WordPress on Magento platform and you also want to display popular or latest/recent posts (with title and image/thumbnail also if you like) into sidebar blog (left or right side) around your site.

To do this you need navigate to location: /app/design/frontend/your-package/default/template/wordpress/ open the file sidebar.phtml

then add the following code into <div class=”wp-sidebar”>

Code:

<?php $posts = Mage::getResourceModel('wordpress/post_collection') ->addPostTypeFilter('post')
		->setOrderByPostDate()
		->addIsViewableFilter()
		->setPageSize(10)
		->load(); ?>
	<?php if (count($posts) > 0): ?>
	
<div class="block block-list block-articles">
		
<div class="block-title">
			<strong><span><?php echo $this->__('Latest posts') ?></span></strong>
		</div>

		
<div class="block-content">
			
<ol id="articles-items">
				<?php foreach($posts as $post): ?>
					
<li class="item">
						<a href="<?php echo $post->getPermalink() ?>"><?php echo $this->escapeHtml($post->getPostTitle()) ?></a>
					</li>

				<?php endforeach; ?>
			</ol>

		</div>

	</div>

	<?php endif; ?>

if you also want to display image/thumbnail there, you can use this code:

<?php if ($image = $post->getFeaturedImage()): ?>
					<a href="<?php echo $post->getPermalink() ?>">
						<img src="<?php echo $image->getAvailableImage() ?>" src="<?php echo $this->escapeHtml($post->getPostTitle()) ?>" />
					</a>
				<?php endif; ?>

    6 Comments

  1. I’m really loving the theme/design of your website. Do you ever run into any internet browser compatibility issues?
    A couple of my blog visitors have complained about my blog not operating correctly in Explorer but looks great in Firefox.
    Do you have any ideas to help fix this issue?

    Reply

  2. Wonderful beat ! I wish to apprentice while you amend your website, how can i subscribe for a blog website? The account aided me a acceptable deal. I had been tiny bit acquainted of this your broadcast offered bright clear concept

    Reply

    • So sorry when responding to you late. If you need some helps you can reply my comment or contact us on contact page. We will check and reply to you for sure. We’re glad to hearing from you. Thanks !

      Reply

Post a Comment

Please keep in mind that all comments are read and moderation.
Your email address WILL NOT be published. Please DO NOT use keywords in the Real Name field. Thank you !