我正在使用这个Bootstrap 表插件。但是按日期排序不能正常工作。
这是代码:
<table class=" table-striped" id="table" data-toggle="table"
data-search="true"
data-filter-control="true"
data-click-to-select="true"
data-escape="false">
<thead>
<tr>
<th data-field="expiry_date" data-sortable="true" scope="col"><?= 'expiry date' ?></th>
</tr>
</thead>
Run Code Online (Sandbox Code Playgroud)
日期格式如下:d/m/y(17/7/14)
我如何修复它以正确排序日期?
我正在打电话,woocommerce_product_query但不在 工作Divi theme。我检查了一下,它可以与其他内置的 WordPress 主题一起使用。
我正在使用Query Monitor,我可以看到它正确触发,但我仍然得到所有产品,而不是我硬编码的产品post__in。
这是我的代码:
add_action( 'woocommerce_product_query', 'my_pre_get_posts_query', 9999 );
function my_pre_get_posts_query( $query ) {
$meta_query = $query->get( 'meta_query' );
$query->set( 'post__in', ['245374','245372'] );
}
Run Code Online (Sandbox Code Playgroud)
是否存在任何已知的对 Divi 的干扰?可能会出现什么问题?我检查了父子 Divi 主题。
迪维主题代码:
/**
* Filter the products query arguments.
*
* @since 4.0.5
*
* @param array $query_args Query array.
*
* @return array
*/
public function filter_products_query( $query_args ) {
if ( is_search() ) {
$query_args['s'] = get_search_query();
} …Run Code Online (Sandbox Code Playgroud)