小编B.V*_*mar的帖子

如何使用 wp_query woocommerce 获得最畅销的产品

我想在主页上获得最畅销的产品。我正在使用下面的查询但这并没有获得所有类别的最畅销产品。

如果我放置最畅销的产品短代码,该代码有效,但自定义结构无法获得这些产品。这些我的查询功能..

function get_product_posts_hp()
{
    wp_reset_query();
    $args = array(
        'posts_per_page' => 12,
        'post_type' => 'product',
        'post_status' => 'publish',
        'ignore_sticky_posts'   => 1,
        'meta_key' => 'total_sales',
        'orderby' => 'meta_value_num',
        'order' => 'DESC',
    );
    return new WP_Query($args);
}

Thanks In Advance..
Run Code Online (Sandbox Code Playgroud)

php wordpress product woocommerce

6
推荐指数
1
解决办法
9926
查看次数

如何在 Element BEM Scss 中选择 nth-child

我正在使用 BEM Scss 请解释如何在第 n 个子元素中进行选择。

我尝试了以下格式,但它对我不起作用

<div class="bookearly-container" >
    <div class="row bookearly-container__row">
        <div class="col-xs-12 col-md-4 bookearly-container__col">
            <div class="bookearly-container__discountcontainer">
            </div>
            <div class="bookearly-container__discountcontainer">
            </div>
            <div class="bookearly-container__discountcontainer">
            </div>
        </div>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我的 BEM Scss 我添加了 nth-child 第三个元素子元素,但该元素不起作用:

.bookearly-container {
    &__row {
        margin-bottom: 4.6rem;
        & > :nth-child(3) {
            &__discountcontainer {  -- this element not selected
                &:before {
                    display: none;
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

能解释一下如何选择吗?提前致谢。

sass bem

5
推荐指数
1
解决办法
2138
查看次数

标签 统计

bem ×1

php ×1

product ×1

sass ×1

woocommerce ×1

wordpress ×1