0

我正在使用 Magento 和 WordPress,所以选择了 FishPig 模块。我有一个 CMS 页面,并且正在使用相关的博客帖子选项卡来选择要在此页面上显示的帖子,这一切都按预期工作。

我面临的问题是,当我尝试使用 Magento 中选择的每个帖子旁边的位置框时,无论我将它们设置为什么顺序,它们在前端始终保持相同的顺序。

我知道在 Magentos 类别中,您可以使用相同的位置框来订购产品在该特定类别上的显示方式,所以我想对下面的代码使用相同的功能来订购博客文章,但我不知道如何让它工作.

    <?php if (($posts = $this->getPostCollection()) !== false): ?>
    <?php if (count($posts) > 0): ?>
        <div class="box-collateral box-description" style="padding:5px 20px;">
            <!--<?php if ($title = $this->getTitle()): ?>
                <h2 style="margin-bottom:15px;">Blog <span style="color: #68d088;">Posts</span></h2>

            <?php endif; ?>-->
            <div class="std">
                <ul>
                <?php foreach($posts as $post): ?>
                    <li class="related-blogs">
                        <a href="<?php echo $post->getPermalink() ?>"><h2><?php echo $this->escapeHtml($post->getPostTitle()) ?></h2></a>
                        <div class="content">
                            <?php 
                                $pos = strpos($post['post_content'], ' ', 300);
                                echo substr($post['post_content'],0,$pos );
                            ?>
                        </div>
                        <a style="color:#68d088; font-weight:bold;" href="<?php echo $post->getPermalink() ?>">Read More...</a>
                    </li>
                <?php endforeach; ?>
                </ul>
            </div>
        </div>
    <?php endif; ?>
    <?php endif; ?>
4

0 回答 0