0

I'm trying to get the featured image from a wordpress page to display outside of the fishpig template. My site uses banners from Magento for product/category pages, but I also wish to use the same banner area for WordPress featured images if possible.

So for example, if I go to a page created in wordpress and that page has a featured image defined, I'd want that to display in the block which I use for Magento banners.

I've included:

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

...in my banner phtml block, but obviously it needs $post to be defined to work.

To do that I've added (based on some other documentation):

<?php $post =  Mage::getResourceModel('wordpress/post')->load(); ?>

But again, I'd need an ID in there and I don't really know how to get that either.

So what I'm really asking is how do I get the ID of the current page/post? If I can't get that, is there a way of getting the featured image to display somehow?

Hopefully I'm not being too numb here! Tom

2

After emailing back and forth with support, I was told you could pull wordpress posts into other cms pages using FishPig\WordPress\Block\Post\ListPost. I believe extending this could possibly show the featured image of a post only. I haven't tried implementing to, for instance the homepage, but this seems like it could work.

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.