1

I have two websites :

  1. Wordpress
  2. Magento

I know the plugin of fishpig but I want to know how I can still have my WP blog and showing the posts into my Magento ( CMS for example ). Thanks for your answer

2
Assuming you have installed `FISHPIG` extension.

Goto

app/design/frontend/base/default/template/wordpress/sidebar/widget

create a file and lets name it as recents.phtml and add the below code.

<?php
/**
* @category Fishpig
* @package Fishpig_Wordpress
* @license http://fishpig.co.uk/license.txt
* @author Ben Tideswell <help@fishpig.co.uk>
*/
?>
<?php $posts = $this->getPosts() ?>
<?php if (count($posts) > 0): ?>
<div>
<ul id="<?php echo $this->getListId() ?>">
<?php foreach($posts as $post): ?>
<?php $post->setExcerptSize($this->getExcerptLength()) ?>
<li>
<?php if ($this->canDisplayExcerpt()): ?>
<a href="<?php echo $post->getPermalink() ?>" title="<?php echo $this->htmlEscape($post->getPostTitle()) ?>">
<p><?php $content = $post->getPostExcerpt(); $content = strip_tags($content); echo substr($content, 0, 250); ?> ...</p>
</a>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
<script type="text/javascript">decorateList('<?php echo $this->getListId() ?>')</script>
<?php if ($this->canShowPager()): ?>
<?php echo $this->getPagerHtml() ?>
<?php endif; ?>
</div>
<?php endif; ?>

Now create a CMS BLOCK say Recent posts and id recent_posts and add below code in content of that CMS Block.

{{block type=”wordpress/sidebar_widget_posts” name=”wordpress.widget.recent_posts” post_count=”1″ title=”Latest Blogs” excerpt=”on” excerpt_length=”250″ date=”off” comment_num=”off” template=”wordpress/sidebar/widget/recents.phtml”}}

Now call this block where ever you needed for example if you want to call it in .xml files call in this way

<block type="cms/block" name="recent_posts">
   <action method="setBlockId"><block_id>recent_posts</block_id></action>
</block>

To call it in content of CMS pages call in this way

{{block type="cms/block" block_id="recent_posts"}}

Hope this helps.

  • sorry, not working for me – Andhi Irawan Jul 13 '16 at 9:34
  • Hmmm, not working for me either. – Nathan Arthur Aug 4 '16 at 23:47
1

{{block type=”wordpress/sidebar_widget_posts” name=”wordpress.widget.recent_posts” post_count=”1″ title=”Latest Blogs” excerpt=”on” excerpt_length=”250″ date=”off” comment_num=”off” template=”wordpress/sidebar/widget/recents.phtml”}}

to be replaced by

{{block type="wordpress/sidebar_widget_posts" name="wordpress.widget.recent_posts" post_count="1" title="Latest Blogs" excerpt="on" excerpt_length="250" date="off" comment_num="off" template="wordpress/sidebar/widget/recents.phtml"}}

  • What is the difference between replace and need to be replaced content from your answer? – Teja Bhagavan Kollepara Apr 13 at 5:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.