1
votes

I have a magento store. I want to add a blog site(www.example.com/blog) on it using wordpress. For this, i am using Fishpig's Wordpress Integration 2.2.7. I wanted to have a different template for my blog site.

So, i have created a separate template for wordpress blog page. On the top of the page, i want to add recent posts slider i.e, i want to display a featured image of the post with few lines of the content with read more option. Additional information like author, published date will also be there with the content. How can i implement this on the blog page template?

Also my blog sites menu navigation will be different from store's menu navigation.

How can i implement this? Is it possible to do so with this plugin or any other? Please suggest me the best.

Thanks in advance.

2

2 Answers

4
votes

You need to retrieve the image resource, then get the image url

$_image = $_post->getFeaturedImage();

echo $_image->getAvailableImage();

Take a look at Fishpig/Wordpress/Model/Image.php for more url methods:

public function getThumbnailImage()
public function getMediumImage()
public function getLargeImage()
public function getFullSizeImage()
public function getPostThumbnailImage()
public function getAvailableImage()
public function getImageByType($type = 'thumbnail')
2
votes

To get the featured post image you can use

$post->getFeaturedImage();

Where $post is the Fishpig Wordpress post Collection object. Here is an example of getting a post where category_id = 3:

$col_posts = Mage::getResourceModel('wordpress/post_collection')
    ->addIsPublishedFilter()
    ->addCategoryIdFilter(3);
$col_posts->getSelect()->limit(1);
$post = $col_posts->getFirstItem();

You can customize your select using magento EAV on the collection above or see the methods available at Fishpig/Wordpress/Model/Archive.php.

And if you want to put a recent post block, take a look at http://fishpig.co.uk/wordpress-integration/docs/recent-posts-block.html.