亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

回波數組項

回波數組項

PHP
繁星coding 2021-06-30 15:15:14
我正在尋找回顯數組的一部分,將數組的一部分回顯到數據字段中的最佳方法是什么我有一個包含條款 => 訂閱的數組,需要將該字段拉入我的輸入 data-subscription="[echo subscription in here ]"$quantites_required = false;$previous_post      = $post;$count              = 0;$tax_query_args     = [    'post_type' => 'product',    'tax_query' => [        [            'taxonomy' => 'product_type',            'field'    => 'name',            'terms'    => 'subscription',        ],    ],];$tax_query = get_posts($tax_query_args);global $grouped_product;foreach ($tax_query as $post) {    global $post;    $price = get_post_meta(get_the_ID(), '_price', true);    ?><li id="product-<?php the_ID();?>" <?php post_class();?>>    <div class="prod-name">        <div class="radio">            <input type="checkbox" id="product-<?php the_ID();?>" value="1" name="quantity[<?php the_ID();?>]" class="wc-grouped-product-add-to-cart-checkbox js-group-item-sel" <?php echo ($count != 0 ? '' : ' checked="checked"'); ?> data-subscription="[echo terms subrciptions here]" />            <label for="product-<?php the_ID();?>">                <?php echo the_title(); ?>            </label>        </div>    </div>    <div class="prod-price" data-price="<?php echo number_format($price, 2); ?>">        <p>            <?php echo wc_price($price); ?>        </p>    </div>    <div class="prod_flag">        <?php get_product_flags(true); //Hide featured for grouped child items. ?>    </div>    <?php$count = $count + 1;}$count = 0;
查看完整描述

1 回答

?
侃侃爾雅

TA貢獻1801條經驗 獲得超16個贊

替換這一行

<input type="checkbox" id="product-<?php the_ID();?>" value="1" name="quantity[<?php the_ID();?>]" class="wc-grouped-product-add-to-cart-checkbox js-group-item-sel" <?php echo ($count != 0 ? '' : ' checked="checked"'); ?> data-subscription="[echo terms subrciptions here]" />

<input type="checkbox" id="product-<?php the_ID();?>" value="1" name="quantity[<?php the_ID();?>]" class="wc-grouped-product-add-to-cart-checkbox js-group-item-sel" <?php echo ($count != 0 ? '' : ' checked="checked"'); ?> data-subscription="<?php echo ($tax_query_args['tax_query'][0]['terms']); ?>" />



查看完整回答
反對 回復 2021-07-02
  • 1 回答
  • 0 關注
  • 151 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號