小编Rez*_*eza的帖子

如何反转数组数据?

我想要数组1,3,5,7,9的布局与数组0,2,4,6,8,10的布局相反右边,描述在左边,并且连续不断。

这是我的function.php代码

<?php
            foreach ( $termchildren as $child ) {
                $term = get_term_by( 'id', $child, $taxonomy_name );
                $image = get_field('featured_image', $term);

                ?>
                <div class="row">
                    <div id="product-cat <?php echo $term->slug ?>">
                        <div class="two-col product-cat-image">
                            <img src="<?php echo $image ?>">
                        </div>
                        <div class="two-col product-cat-details">
                            <?php
                                echo '<h4>'. $term->name .'</h4>';
                                echo '<p>'. $term->description .'</p>';
                                echo '<a class="product-cat-button" href="' . get_term_link( $child, $taxonomy_name ) . '">See Products</a>';
                            ?>
                        </div>
                    </div>
                </div><?php
            } ?>
Run Code Online (Sandbox Code Playgroud)

CSS代码:

.row{
  display: flex;
  margin-left: -10px;
  margin-right: -10px;
  margin-bottom: 15px;
} …
Run Code Online (Sandbox Code Playgroud)

css php arrays wordpress

0
推荐指数
1
解决办法
129
查看次数

标签 统计

arrays ×1

css ×1

php ×1

wordpress ×1