Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何使用orderby自定义字段按升序获取自定义邮政产品_Php_Mysql_Wordpress_Plugins - Fatal编程技术网

Php 如何使用orderby自定义字段按升序获取自定义邮政产品

Php 如何使用orderby自定义字段按升序获取自定义邮政产品,php,mysql,wordpress,plugins,Php,Mysql,Wordpress,Plugins,我正在获取自定义邮政产品,我的要求是获取产品 使用自定义产品字段进行升序 <?php # # rt-theme product loop # global $args,$wp_query; //column $box_counter = 0; if(is_tax()) $args = array_merge( $wp_query->query, $args); $args1['orderby'] = 'wpcf-watt'; $args2['order'] ='A

我正在获取自定义邮政产品,我的要求是获取产品

使用自定义产品字段进行升序

<?php
# 
# rt-theme product loop
#
global $args,$wp_query; 

//column

$box_counter = 0;

if(is_tax()) $args = array_merge( $wp_query->query, $args);



 $args1['orderby'] = 'wpcf-watt';
 $args2['order'] ='ASC';
 $args = array_merge($args, $args1);

 $args = array_merge($args, $args2);

query_posts($args); 

$product = array();
$postCount = 0;

if ( have_posts() ) : while ( have_posts() ) : the_post();


?>

    <?php
    //box class

    $product[$postCount]['title']       =   get_the_title();
    $product[$postCount]['thumb']       =   find_image_org_path(get_post_meta($post->ID, THEMESLUG.'product_image_url', true));
    $product[$postCount]['image']       =   @vt_resize( '', $thumb, $w, $h, ''.$crop.'' );
    $product[$postCount]['short_desc']  =   get_post_meta($post->ID, THEMESLUG.'short_description', true);
    $product[$postCount]['permalink']   =   get_permalink();
    $product[$postCount]['watt']        =   get_post_meta($post->ID, 'wpcf-watt', true);    

    $postCount = $postCount + 1;
    ?>

<?php endwhile?>
<?php

    echo "<pre>";print_r($product);



?>

<?php endif; wp_reset_query();?>
[orderby]=>wpcf瓦特

wpcf-watt是我在产品中使用的自定义字段。我在自定义post产品中为自定义字段使用了工具集插件

问题是产品并没有按照wpcf瓦特来排序,我不知道如何从数据库中按升序对产品进行排序

Array
(
    [paged] => 2
    [taxonomy] => product_categories
    [term] => 12-volt-power-inverters
    [post_status] => publish
    [orderby] => wpcf-watt
    [order] => ASC
)