私はこの問題を解決する能力を超えています。
達成する必要があること: このページでは、カスタム投稿タイプ「Listings」の一部である「New Developments」のカスタム分類の下で、「Doral」という用語でラベル付けされたアイテムのみの結果を表示する必要があります。
現在、このページには、カスタム投稿タイプ「リスティング」の用語または分類に関係なく、すべてのアイテムが表示されています。
私が現在持っているもの: 私のカスタム分類法作成コード
add_action('init', 'property_new_dev_taxonomies');
function property_new_dev_taxonomies() {
register_taxonomy('new-developments',
'listing',
array (
'labels' => array (
'name' => 'New Developments',
'singluar_name' => 'New Developments',
'search_items' => 'Search New Developments',
'popular_items' => 'Popular New Developments',
'all_items' => 'All New Developments',
'parent_item' => 'Parent New Development',
'parent_item_colon' => 'Parent New Development:',
'edit_item' => 'Edit New Development',
'update_item' => 'Update New Development',
'add_new_item' => 'Add New Development',
'new_item_name' => 'New Developments',
),
'hierarchical' => true,
'show_ui' => true,
'show_tagcloud' => true,
'rewrite' => array( 'slug' => 'new-developments'),
'query_var' => 'new-developments',
'public'=>true)
);
}
カスタム分類テンプレート (taxonomy-new-developments.php)
<?php
/*
Template Name: Taxonomy New Developments
*/
?>
<?php get_header() ?>
<div id="columnswrapper" class="columns-1">
<?php get_sidebar(); ?>
<div id="content" class="norightsidebar">
<div class="inner">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
<?php $term = $wp_query->queried_object; echo '<h2>'.$term->name.'</h2>'; ?>
<?php $term = new WP_Query('post_type=listing', 'taxonomy=new-developments', 'field=slug', 'terms=doral'); ?>
<?php if ($term->have_posts()) : while ($term->have_posts()) : $term->the_post(); ?>
<?php include 'includes/variables.php' ?>
<div class="searchresult">
<?php
$arr_sliderimages = get_gallery_images();
//$firstimage = $arr_sliderimages[0];
//$arr_sliderimages = parse_url($firstimage);
$resized = aq_resize($arr_sliderimages[0], 250, 185, true);
?>
<div class="resultimage">
<?php include 'includes/bannerssmall.php'; ?>
<?php if ($mlslisting == "Yes" && $mlsnumber) { ?>
<a href="<?php bloginfo('url') ?>/idx/mls-<?php echo $mlsnumber ?>-"><img width="250" height="185" alt="Image for <?php the_title(); ?>" src="<?php echo $resized ?>" /></a>
<?php } else { ?>
<a href="<?php the_permalink(); ?>"><img width="250" height="185" alt="Image for <?php the_title(); ?>" src="<?php echo $resized ?>" /></a>
<?php } ?>
</div>
<div class="resultdetails">
<div class="primary-data">
<div class="address">
<?php if ($mlslisting == "Yes" && $mlsnumber) { ?>
<a href="<?php bloginfo('url') ?>/idx/mls-<?php echo $mlsnumber ?>-"><?php the_title() ?>, <?php echo $citystatezip ?></a>
<?php } else { ?>
<a href="<?php the_permalink() ?>"><?php the_title() ?>, <?php echo $citystatezip ?></a>
<?php } ?>
</div>
<div class="price">
<?php include 'includes/price.php'; ?>
</div>
</div>
<div class="secondary-data">
<?php if ($beds) { ?>
<div><?php echo $beds ?> <?php echo get_option('wp_bedrooms_text'); ?>, <?php echo $baths; ?> <?php echo get_option('wp_bathrooms_text'); ?></div>
<?php } ?>
<?php if ($homesize) { ?>
<div><?php echo get_option('wp_homesize_text') ?>: <?php echo $homesize ?></div>
<?php } ?>
<?php if ($lotsize) { ?>
<div><?php echo get_option('wp_lotsize_text') ?>: <?php echo $lotsize ?></div>
<?php } ?>
<?php if ($year) { ?>
<div><?php echo get_option('wp_yearbuilt_text') ?>: <?php echo $year ?></div>
<?php } ?>
</div>
<a class="button" href="<?php the_permalink(); ?>"><?php echo get_option('wp_read_more_text') ?></a>
</div><!-- end resultdetails -->
</div><!-- end searchresult -->
<?php endwhile; else: ?>
<p><strong>There are no items to display. Make sure you add 1 or more posts using the "Listings" category. Also, in Theme Options, make sure the slideshow is using the "Listings" category.</strong></p>
<?php endif;
wp_reset_query(); ?>
</div><!-- end inner -->
</div><!-- end content -->
</div><!-- end columnswrapper -->
<?php get_footer(); ?>
私はあまりにも長い間自分自身を手に入れようとしてきましたが、これを機能させるために必死に助けが必要です.
よろしくお願いします。
======================================= 編集:コメントに基づいてこれを試しましたが、それはまだ動作していません -
<?php
/*
Template Name: Taxonomy New Developments
*/
?>
<?php get_header() ?>
<div id="columnswrapper" class="columns-1">
<?php get_sidebar(); ?>
<div id="content" class="norightsidebar">
<div class="inner">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
<?php $term = $wp_query->queried_object; echo '<h2>'.$term->name.'</h2>'; ?>
<?php $term = new WP_Query('post_type=listing', 'taxonomy=new-developments', 'field=slug', 'terms=doral'); ?>
<?php if ($term->have_posts()) :
$args = array(
'post_type' => 'Listing',
'new-developments' => $term->slug
);
query_posts($args);
while ($term->have_posts()) : $term->the_post(); ?>
<?php include 'includes/variables.php' ?>
<div class="searchresult">
<?php
$arr_sliderimages = get_gallery_images();
//$firstimage = $arr_sliderimages[0];
//$arr_sliderimages = parse_url($firstimage);
$resized = aq_resize($arr_sliderimages[0], 250, 185, true);
?>
<div class="resultimage">
<?php include 'includes/bannerssmall.php'; ?>
<?php if ($mlslisting == "Yes" && $mlsnumber) { ?>
<a href="<?php bloginfo('url') ?>/idx/mls-<?php echo $mlsnumber ?>-"><img width="250" height="185" alt="Image for <?php the_title(); ?>" src="<?php echo $resized ?>" /></a>
<?php } else { ?>
<a href="<?php the_permalink(); ?>"><img width="250" height="185" alt="Image for <?php the_title(); ?>" src="<?php echo $resized ?>" /></a>
<?php } ?>
</div>
<div class="resultdetails">
<div class="primary-data">
<div class="address">
<?php if ($mlslisting == "Yes" && $mlsnumber) { ?>
<a href="<?php bloginfo('url') ?>/idx/mls-<?php echo $mlsnumber ?>-"><?php the_title() ?>, <?php echo $citystatezip ?></a>
<?php } else { ?>
<a href="<?php the_permalink() ?>"><?php the_title() ?>, <?php echo $citystatezip ?></a>
<?php } ?>
</div>
<div class="price">
<?php include 'includes/price.php'; ?>
</div>
</div>
<div class="secondary-data">
<?php if ($beds) { ?>
<div><?php echo $beds ?> <?php echo get_option('wp_bedrooms_text'); ?>, <?php echo $baths; ?> <?php echo get_option('wp_bathrooms_text'); ?></div>
<?php } ?>
<?php if ($homesize) { ?>
<div><?php echo get_option('wp_homesize_text') ?>: <?php echo $homesize ?></div>
<?php } ?>
<?php if ($lotsize) { ?>
<div><?php echo get_option('wp_lotsize_text') ?>: <?php echo $lotsize ?></div>
<?php } ?>
<?php if ($year) { ?>
<div><?php echo get_option('wp_yearbuilt_text') ?>: <?php echo $year ?></div>
<?php } ?>
</div>
<a class="button" href="<?php the_permalink(); ?>"><?php echo get_option('wp_read_more_text') ?></a>
</div><!-- end resultdetails -->
</div><!-- end searchresult -->
<?php endwhile; else: ?>
<p><strong>There are no items to display. Make sure you add 1 or more posts using the "Listings" category. Also, in Theme Options, make sure the slideshow is using the "Listings" category.</strong></p>
<?php endif;
wp_reset_query(); ?>
</div><!-- end inner -->
</div><!-- end content -->
</div><!-- end columnswrapper -->
<?php get_footer(); ?>