programing

워드프레스 플러그인의 테이블에 다른 열 추가

lovejava 2023. 2. 23. 21:57

워드프레스 플러그인의 테이블에 다른 열 추가

여러분, 이브닝

제품 위시리스트 디스플레이 플러그인이 있는 워드프레스 웹사이트에서 일하고 있습니다.

이제 단일 열에 제품만 표시됩니다.나는 그것을 그리드로 하고 싶다.

저는 식탁을 잘 못 차려요.누가 좀 도와주실래요?

도움을 요청하지 않고 직접 해야 하는 거 알아요.하지만 내일까지 해야 할 일이 있어서 꼼짝할 수가 없어...이 질문이 규칙을 어겼다면 관리자에게 사과드립니다.

코드:

<?php
/**
* The Template for displaying wishlist.
 *
 * @version             1.3.1
 * @package           TInvWishlist\Template
 */

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}

?>
<div class="tinv-wishlist woocommerce tinv-wishlist-clear">
<?php do_action( 'tinvwl_before_wishlist', $wishlist ); ?>
<?php if ( function_exists( 'wc_print_notices' ) ) { wc_print_notices(); } ?
>
<form action="<?php echo esc_url( tinv_url_wishlist() ); ?>" method="post" autocomplete="off">
    <?php do_action( 'tinvwl_before_wishlist_table', $wishlist ); ?>
    <table class="tinvwl-table-manage-list">
        <thead>
            <tr>
                <?php if ( $wishlist_table['colm_checkbox'] ) { ?>
                    <th class="product-cb"><input type="checkbox" class="global-cb"></th>
                <?php } ?>
                <th class="product-remove"></th>
                <th class="product-thumbnail">&nbsp;</th>

                <?php if ( $wishlist_table_row['move'] || $wishlist_table_row['add_to_card'] ) { ?>
                    <th class="product-action">&nbsp;</th>
                <?php } ?>
            </tr>
        </thead>
        <tbody>
            <?php do_action( 'tinvwl_wishlist_contents_before' ); ?>

            <?php
            foreach ( $products as $wl_product ) {
                $product = apply_filters( 'tinvwl_wishlist_item', $wl_product['data'] );
                unset( $wl_product['data'] );
                if ( $wl_product['quantity'] > 0 && apply_filters( 'tinvwl_wishlist_item_visible', true, $wl_product, $product ) ) {
                    $product_url = apply_filters( 'tinvwl_wishlist_item_url', $product->get_permalink(), $wl_product, $product );
                    ?>
                    <tr class="<?php echo esc_attr( apply_filters( 'tinvwl_wishlist_item_class', 'wishlist_item', $wl_product, $product ) ); ?>">
                        <?php if ( $wishlist_table['colm_checkbox'] ) { ?>
                            <td class="product-cb">
                                <?php
                                echo apply_filters( 'tinvwl_wishlist_item_cb', sprintf( // WPCS: xss ok.
                                    '<input type="checkbox" name="wishlist_pr[]" value="%d">', esc_attr( $wl_product['ID'] )
                                ), $wl_product, $product );
                                ?>
                            </td>
                        <?php } ?>
                        <td class="product-remove">
                            <button type="submit" name="tinvwl-remove" value="<?php echo esc_attr( $wl_product['ID'] ); ?>" >X</button>
                        </td>
                        <td class="product-thumbnail">
                            <?php
                            $thumbnail = apply_filters( 'tinvwl_wishlist_item_thumbnail', $product->get_image(), $wl_product, $product );

                            if ( ! $product->is_visible() ) {
                                echo $thumbnail; // WPCS: xss ok.
                            } else {
                                printf( '<a href="%s">%s</a>', esc_url( $product_url ), $thumbnail ); // WPCS: xss ok.
                            }
                            ?>
                        </td>

                        <?php if ( $wishlist_table_row['move'] || $wishlist_table_row['add_to_card'] ) { ?>
                            <td class="product-action">

                                <?php
                                if ( apply_filters( 'tinvwl_wishlist_item_action_move', $wishlist_table_row['move'], $wl_product, $product ) ) {
                                    echo apply_filters( 'tinvwl_wishlist_item_move', sprintf( '<button class="button tinvwl_move_product_button" type="button" name="move"><i class="fa fa-arrow-right"></i><span class="tinvwl-txt">%s</span></button>', esc_html( __( 'Move', 'ti-woocommerce-wishlist-premium' ) ) ), $wl_product, $product, $wishlist ); // WPCS: xss ok.
                                } ?>
                            </td>
                        <?php } ?>
                    </tr>
                    <?php
                }
            }
            ?>
            <?php do_action( 'tinvwl_wishlist_contents_after' ); ?>
        </tbody>
        <tfoot>
            <tr>
                <td colspan="100%">
                    <?php do_action( 'tinvwl_after_wishlist_table', $wishlist ); ?>
                    <?php wp_nonce_field( 'tinvwl_wishlist_owner', 'wishlist_nonce' ); ?>
                </td>
            </tr>
        </tfoot>
    </table>
</form>
<?php do_action( 'tinvwl_after_wishlist', $wishlist ); ?>
<div class="tinv-lists-nav tinv-wishlist-clear">
    <?php do_action( 'tinvwl_pagenation_wishlist', $wishlist ); ?>
</div>
</div>

제거한다.<table class="tinvwl-table-manage-list">그리고.</table>

에서 모든 항목 제거<thead>로.</thead>

바꾸다<tbody>로.<div class="product-table">그리고.</tbody>로.</div>

이내에foreach ( $products as $wl_product )바꾸다<tr로.<div모든 것을 변경<td로.<div

바꾸다<tfoot> <tr> <td colspan="100%">로.<div class="product-list-footer">

CSS를 업데이트하여 설정하다

div.product-table{
box-sizing:border-box;
width:100%; /* Or something else appropriate */
}
div.product-table > div{
box-sizing:border-box; /* makes sure border and padding fits inside the 50% */
width:50%;
}

다른 많은 CSS도 조정해야 하지만, 이것으로 시작할 수 있습니다.

언급URL : https://stackoverflow.com/questions/45513101/adding-another-column-to-a-table-in-a-wordpress-plugin