日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > php >内容正文

php

php中get_featured_posts()是什么意思,php – 在WP_Query中获取WooCommerce特色产品

發布時間:2024/9/19 php 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 php中get_featured_posts()是什么意思,php – 在WP_Query中获取WooCommerce特色产品 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

自Woocommerce 3以來,您需要使用Tax Query,因為特色產品現在由product_visibility自定義分類法處理,用于以下術語:

// The tax query

$tax_query[] = array(

'taxonomy' => 'product_visibility',

'field' => 'name',

'terms' => 'featured',

'operator' => 'IN', // or 'NOT IN' to exclude feature products

);

// The query

$query = new WP_Query( array(

'post_type' => 'product',

'post_status' => 'publish',

'ignore_sticky_posts' => 1,

'posts_per_page' => $products,

'orderby' => $orderby,

'order' => $order == 'asc' ? 'asc' : 'desc',

'tax_query' => $tax_query // <===

) );

參考文獻:

You could use 07002 to get the featured product IDs array but using a tax query in a WP_Query is just fine and the right way…

有關:

它應該有效.

總結

以上是生活随笔為你收集整理的php中get_featured_posts()是什么意思,php – 在WP_Query中获取WooCommerce特色产品的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。