Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I trying to create my taxonomy.php from this code:

<?php
    $posts_per_row = 4;
    $posts_per_page = -1;
    $pageURL = 'http';
    $post_type = 'radio';
    if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
        $pageURL .= "://";
        if ($_SERVER["SERVER_PORT"] != "80") {
            $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
        } else {
            $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
        }
        $letters = $wpdb->get_col(
        "SELECT DISTINCT LEFT(post_title,1) AS first_letter FROM $wpdb->posts
        WHERE post_type = '$post_type' AND post_status = 'publish'
        ORDER BY first_letter ASC"
        );
        $first_letter = ($_GET['first_letter']) ? $_GET['first_letter'] : $letters[0];
?>

<?php get_header(); ?>    
    <div id="container" class="onecolumn">
        <div id="main-column">
            <h1><?php echo (get_query_var( 'taxonomy' )." - ".get_query_var( 'term' )); ?></h1>
        </div>  <!-- main-column -->
    <div class="taxnavigation">
    <table border="0" ><tr> <!-- display avaible letter list -->
        <?php
        foreach ($letters as $letter) { 
                    $url = add_query_arg('first_letter',$letter,$pageURL);
                    ?><td style="width:150px; word-wrap: break-word"><?php
                    echo("<a href='$url' title='Starting letter $letter' >$letter</a>"); 
                    ?></td><?php

        }
        ?>
    </tr></table></div> <!-- taxnavigation  -->
    <div class='clear'></div>
        <div id="a-z">
            <?php
            $mam_global_where = " AND LEFT(post_title,1) = '$first_letter' ";
            $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
            $args = array (
                'posts_per_page' => $posts_per_page,
                'post_type' => $post_type,
                'orderby' => 'title',
                'order' => 'ASC',
                'paged' => $paged,
                'caller_get_posts' => 1 );
            query_posts($args);
            $mam_global_where = ''; // Turn off filter
            if ( have_posts() ) {
            $in_this_row = 0;
            while ( have_posts() ) { 
                the_post();
                $first_letter = strtoupper(substr(apply_filters('the_title',$post->post_title),0,1));
                if ($first_letter != $curr_letter) {
                    if (++$post_count > 1) { end_prev_letter(); }
                    start_new_letter($first_letter);
                    $curr_letter = $first_letter;
                    }
                if (++$in_this_row > $posts_per_row) {
                    end_prev_row();
                    start_new_row();
                    ++$in_this_row; // Account for this first post
                    } ?>
                <div class="title-cell"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to                  <?php the_title_attribute(); ?>"><?php the_title(); ?></a></div>
                <?php }
            end_prev_letter();
            ?>

    <?php } else {
     echo "<h2>Sorry, no posts were found!</h2>";
    }
    ?>
    </div><!-- End id='a-z' -->
    </div><!-- End id='onecolumn' -->

    <?php get_footer(); ?>
    <?php
    function end_prev_letter() {
    end_prev_row();
     echo "</div><!-- End of letter-group -->\n";
     echo "<div class='clear'></div>\n";
    }
    function start_new_letter($letter) {
     echo "<div class='letter-group'>\n";
     echo "\t<div class='letter-cell'>$letter</div>\n";
    start_new_row($letter);
    }
    function end_prev_row() {
     echo "\t</div><!-- End row-cells -->\n";
    }
    function start_new_row() {
     global $in_this_row;
     $in_this_row = 0;
     echo "\t<div class='row-cells'>\n";
    }
?>

this code display a list of post by the first letter of the post title and display the list of all available letters (menu of the letters).

Now, as you understand - it's my taxonomy.php page so I want to get only the relevant taxonomy posts and not all post as you can see above. I mean when I'll choose "English" [as get_query_var( 'taxonomy' )] on the "language" [as get_query_var( 'term' )] taxonomy this page will give me a list of post (or custom post in my case) with the English language. Please help me! Thanks a lot!!!

share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.