Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.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_Wordpress_Taxonomy - Fatal编程技术网

php Wordpress插件分类法类别和帖子排序

php Wordpress插件分类法类别和帖子排序,php,wordpress,taxonomy,Php,Wordpress,Taxonomy,我使用的主题在管理面板中有内置的公文包选项卡。 此主题使用公文包项目和公文包类别,而不是原始的帖子项目和类别 我已经构建了一个插件,该插件将公文包的分类法列为“类别” 我发送了一个错误的键,而不是“cat”,它应该是->categories query_posts( array ( 'categories' => $category_id, 'posts_per_page' => -1, 'post_type' => 'portfolio', 'post_status' =&

我使用的主题在管理面板中有内置的公文包选项卡。 此主题使用公文包项目和公文包类别,而不是原始的帖子项目和类别

我已经构建了一个插件,该插件将公文包的分类法列为“类别”



我发送了一个错误的键,而不是“cat”,它应该是->categories

query_posts( array ( 'categories' => $category_id, 'posts_per_page' => -1, 'post_type' => 'portfolio', 'post_status' => publish, 'orderby' => 'title', 'order' => 'ASC' ) );

那是哪种类型的帖子?还有,第一个代码示例中的
var\u dump($args)
是什么?post类型是portfolio$args实际上什么都不是,可以用默认的attributery替换它,将
post_type=portfolio
添加到
$q
字符串中。否则,
query\u posts
将查看默认的帖子类型(posts)。这是可行的,但它现在显示每个投资组合项目,但它仅在启动时显示,当我选择分类并运行搜索过滤器时,它不显示任何内容。因此,现在您需要了解默认类别是针对帖子类型“post”(默认帖子类型)。对于自定义文章类型,您没有类别,而是自定义分类法。查找如何查询与自定义帖子类型一起使用的自定义分类法。
<input style = "height: 35px;
padding: 10px 45px;" type = "submit" value = "הצג" /> </form>
   <table class="widefat" style = "margin: 0 auto;width: 908px;">
        <thead>
            <tr>
                <th>Category</th>
                <th>Name</th>
            </tr>
        </thead>
        <tbody>
        <?php
            $category_id = get_cat_ID(''.$_POST['filter'].'');
            $q = 'cat=' . $category_id;
            query_posts($q);
            if (have_posts()) : while (have_posts()) : the_post(); ?>
           <tr> <td> <?php echo $_POST['filter']; ?> </td> <td> <a href="<?php the_permalink();?>"><?php the_title(); ?></a> </td> </tr>

           <?php endwhile; endif; ?>
        </tbody>
    </table> 
<input style = "height: 35px;
padding: 10px 45px;" type = "submit" value = "הצג" /> </form>
   <table class="widefat" style = "margin: 0 auto;width: 908px;">
        <thead>
            <tr>
                <th>Category</th>
                <th>Name</th>
            </tr>
        </thead>
        <tbody>
        <?php
            $category_id = $_REQUEST['filter'];
            /* $q = 'cat=' . $category_id; */
            query_posts( array ( 'cat' => $category_id, 'posts_per_page' => -1, 'post_type' => 'portfolio' ) );
            if (have_posts()) : while (have_posts()) : the_post(); ?>
           <tr> <td> <?php echo $_POST['filter']; ?> </td> <td> <a href="<?php the_permalink();?>"><?php the_title(); ?></a> </td> </tr>

           <?php endwhile; endif; ?>
        </tbody>
    </table> 
query_posts( array ( 'categories' => $category_id, 'posts_per_page' => -1, 'post_type' => 'portfolio', 'post_status' => publish, 'orderby' => 'title', 'order' => 'ASC' ) );