0

I am using fishpig magento extension and everything is working perfectly.

I am fetching posts using the code

$posts = $this->getPosts();

and I need tags associated with each post.

0

You can get the tags for an individual post by calling the getTags method on the post object.

<?php $posts = $this->getPosts(); ?>
<?php foreach($posts as $post): ?>
    <?php $tags = $post->getTags() ?>
    <?php if (count($tags) > 0): ?>
        <span><?php echo (count($categories) == 0) ? $this->__('This post was tagged with') : $this->__('and was tagged with') ?> </span> 
        <?php $it = count($tags) ?>
        <?php foreach($tags as $tag): ?>
            <a href="<?php echo $tag->getUrl() ?>">
                <?php echo $tag->getName() ?>
            </a><?php if (--$it > 0): ?>, <?php endif; ?>
        <?php endforeach; ?>
    <?php endif; ?>
<?php endforeach; ?>

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.