How can I display the time of WordPress post (Eg: 1 Day Ago) in Magento fishpig?
<?php $posts = $this->getPosts() ?>
<?php if (count($posts) > 0): ?>
<div class="block block-blog block-recent-posts">
<?php if ($title = $this->getTitle()): ?>
<div class="block-title">
<strong><span><?php echo $this->__($title) ?></span></strong>
</div>
<?php endif; ?>
<div class="block-content">
<ul id="<?php echo $this->getListId() ?>">
<?php foreach($posts as $post): ?>
<li class="item">
<a href="<?php echo $post->getPermalink() ?>" title="<?php echo $this->htmlEscape($post->getPostTitle()) ?>"><?php echo $this->htmlEscape($post->getPostTitle()) ?></a>
</li>
<?php endforeach; ?>
</ul>
<script type="text/javascript">decorateList('<?php echo $this->getListId() ?>')</script>
</div>
</div>
<?php endif; ?>
To get the date of a post you would need to do in your foreach loop:
<?php echo $post->getPostDate() ?>
If you want the difference between now and the postdate, i. e. 1 day ago you probably have to write your own function. Wordpress has its own function human_time_diff for that which does not exist in Magento.