1

我想在我的 wordpress 项目中显示一个元框,它是通过安装 smart mag 主题制作的。它在页面顶部显示一个新闻自动收报机。当我发布任何新闻时,新闻会出现在新闻自动收报机中。但我只想有选择性新闻在主页上,我可以使用元框来控制它,它有两个选项:是或否。如果我按“是”,则该帖子标题将出现在新闻代码中,否则。我的主题中的代码如下:-

<div class="trending-ticker">
                    <span class="heading"><?php echo Bunyad::options()->topbar_ticker_text; // filtered html allowed for admins ?></span>

                    <ul>
                        <?php $query = new WP_Query(apply_filters('bunyad_ticker_query_args', array('orderby' => 'date', 'order' => 'desc', 'posts_per_page' => 8))); ?>

                        <?php while($query->have_posts()): $query->the_post(); ?>

                            <li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>

                        <?php endwhile; ?>

                        <?php wp_reset_postdata(); ?>
                    </ul>
</div>

我怎样才能做到这一点?请帮忙

4

0 回答 0