最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

categories - How to retrieve more posts from a custom post type that are in the same category as the current post

programmeradmin3浏览0评论

The site I'm working on is using a plugin IssueM that created a custom post type called article, and has a custom taxonomy called issuem_issue_categories that has categories such as boat-profile, product-reviews, technique, etc. There are then posts within the article post type of course, and they are in those categories.

Further down the page I am trying to show more posts that are in that same category, but with the query below, I am only getting back 'regular' posts from the built in wordpress post type. I have tried a bunch of different queries, but just cannot get it to return what I need. I know I only have the_title() in there now, but I assume I will be able to get the_post_thumbnail, and the_excerpt too once I actually get it working..

<?php
$args = array (
    array(
        'post_type' => 'article',

        'tax_query' => array(
            array(
                'taxonomy' => 'issuem_issue_categories',
                'field'    => 'slug',
            )
        )
    )
);
$query = new WP_Query( $args );

if( $query->have_posts() ) {
    while( $query->have_posts() ) {
        $query->the_post();
        the_title();
    }
    wp_reset_postdata();

}
?>

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论