Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/252.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 wordpress中的相关公文包查询_Php_Mysql_Wordpress - Fatal编程技术网

Php wordpress中的相关公文包查询

Php wordpress中的相关公文包查询,php,mysql,wordpress,Php,Mysql,Wordpress,我使用wordpress 3.8.1,想展示5个相关的公文包,但我不知道如何查询。 我注册投资组合的代码是 add_action('init', 'portfolio_register'); 函数组合_寄存器{ }我终于找到了答案 $args=array( 'tag__in' => $tag_ids, 'post__not_in' => array($post->ID), 's

我使用wordpress 3.8.1,想展示5个相关的公文包,但我不知道如何查询。 我注册投资组合的代码是

add_action('init', 'portfolio_register');  
函数组合_寄存器{


}我终于找到了答案

$args=array(  
              'tag__in' => $tag_ids,  
              'post__not_in' => array($post->ID),  
              'showposts'=>3,  // Number of related posts that will be shown.  
              'post_type'=> 'portfolio'  
              );  

              $my_query = new wp_query($args);  
最好的

$args=array(  
              'tag__in' => $tag_ids,  
              'post__not_in' => array($post->ID),  
              'showposts'=>3,  // Number of related posts that will be shown.  
              'post_type'=> 'portfolio'  
              );  

              $my_query = new wp_query($args);