基于日期选择器行项目从ACF转发器组中删除行

问题描述 投票:0回答:1

我在Wordpress中使用Advanced Custom Fields Pro设置了中继器组。我想设置一个脚本,该脚本将在日期选择器日期位于当前日期之后删除/隐藏前端的转发器行。

这是我用于页面显示日期行的代码片段:

<?php 

if (have_rows('location')) {
        ?>
    <div class="tab-pane fade" id="location_name" role="tabpanel"
            aria-labelledby="location-tab">
        <?php while (have_rows('location')) {
            the_row(); ?>
                <div class="tab_col usual_text date_col">
                    <?php
                    $orgDate = get_sub_field('date');
                    $newDate = date("l, F d", strtotime($orgDate));
                    echo $newDate; ?>
                </div>
                <div class="tab_col usual_text time_col">
                    <?php the_sub_field('time'); ?>
                </div>
                <div class="tab_col additional_info">
                    <?php the_sub_field('additional_info'); ?>
                </div>
                <div class="tab_col btn_col">
                    <a class="dark_btn" href="<?php the_sub_field('buy_url'); ?>">
                    </a>
                </div>
            </div>
        <?php } ?>
    </div>
<?php } ?>

我的目标是查看子字段“时间”,并将其与当前日期进行比较,如果已经过去,则不显示整行。

甚至,如果所有这些行都过去了,我想确定这一点并返回不同的布局。我只需要确定我可以写的if / else语句来确定所有这些行都消失了。

任何帮助都会很棒!谢谢。

我在Wordpress中使用Advanced Custom Fields Pro设置了中继器组。我想设置一个脚本,该脚本将在日期选择器日期在...

wordpress datepicker advanced-custom-fields
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.