Kategori ve etiketlere göre 5 bölüme Wordpress Bölünmüş Arşivler

1 Cevap php

On my site (currently PHP5, wordpress 2.8.5) I have a lot of categories total=150. Each category is a City name ie: Paris, this has a tag associated with this category. ie: Hotel, Sports, Bars, Entertainment, Food total->5

On my Archive page I'm looking to produce a tabbed section based on my tags. ie:

tab 1: tag->Hotel-> lists all the posts from Paris with the selected tag
tab 2: tag->Sports-> lists all the posts from Paris with the selected tag
tab 3: tag->Bars-> etc...etc..

Arşiv sayfasına bağlantılı bir kategori tıkladıktan sonra, sayfa mesajları görüntülemek için kendisine uygulanan özel bir sorgu gerekir her biri benim 5 baz bölümlere ayrılmıştır.

şimdi sayfa kod herhangi bir varsayılan arşiv sayfası kadar aynı gibi görünüyor.

$post = $posts[0];
if (is_category()) { ?>

    <h2 class="title"><?php single_cat_title(); ?></h2>
    <div style="border-bottom:1px dotted #ccc; text-align:justify;">
<?php echo category_description( $category ); ?>  
    <br />
    <br />  
    </div>  } // end if category

Tab 1:
<strong>Hotels</strong>
<?php query_posts('tag=hotels&showposts=5'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="title"><a href="<?php the_permalink() ?>"><?php the_title() ?></a></div>
<div><?php the_excerpt(); ?></div>
<br />
<?php endwhile; endif; ?>

Tab 2:
<strong>Restaurants</strong>
<?php query_posts('tag=restaurants&showposts=5'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="title"><a href="<?php the_permalink() ?>"><?php the_title() ?></a></div>
<div><?php the_excerpt(); ?></div>
<br />
<?php endwhile; endif; ?>

Sadece şimdi sayfa yük, ancak her sekmesi bölümünde sadece kategori süzülmeye ilişkili etiketi ile tüm mesajlarını listelemek ve olmaz ... etiketi otelden böylece tüm mesajlar listelenir (iyi 5 tanesi yani: showPosts = 5 )

So my question is this:
Is there anyway that the category can be filtered then filtered again based on tag?

1 Cevap

Sorgulanan kategori almak get_query_var kullanın,

if ( is_category() ) { $cat = get_query_var('cat');

sonra sorguda, örneğin kullanım için,

query_posts('tag=hotels&showposts=5&cat='.$cat);