WP: Displaying taxonomy terms by first letter?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tittytweaker
    Confirmed User
    • Dec 2012
    • 184

    #1

    WP: Displaying taxonomy terms by first letter?

    I'm looking for the best way to properly display all of the models for a given letter. So if, for example, someone is looking for "Asa Akira" they can click "A" on my site and search through all the models that start with "A".

    I can't wrap my head around how that would be accomplished though. Each model on my site belongs to the "Model" taxonomy. How would I only display results from my Model taxonomy that start with "A" "B" "C" and so on?
    www.tittytweaker.com
  • fendlestick
    Confirmed User
    • Dec 2012
    • 117

    #2
    Hello, maybe these can get you started.

    http://codecanyon.net/item/taxonomie...widget/4282257
    http://codecanyon.net/item/az-glossa...-index/4481898

    http://codex.wordpress.org/Function_Reference/get_terms

    Comment

    • Tittytweaker
      Confirmed User
      • Dec 2012
      • 184

      #3
      Thanks, but I've already looked at the Wordpress codex and couldn't find anything specifically about dividing up an existing taxonomy the way I'm looking to.

      Anyone else?
      www.tittytweaker.com

      Comment

      • fendlestick
        Confirmed User
        • Dec 2012
        • 117

        #4
        http://wordpress.org/support/topic/h...y-first-letter

        First result on google. If you go to my blog, click porn stars you can see it filter the taxonomy in real time.
        Last edited by fendlestick; 08-29-2013, 12:03 PM.

        Comment

        • Tittytweaker
          Confirmed User
          • Dec 2012
          • 184

          #5
          Yes, I saw that when I was searching for solutions.

          However, that displays all the taxonomy terms on one page.

          I want to be able to show one letter at a time, and if at all possible, I'd like them to display in the same fashion as they would if I clicked on the taxonomy terms themselves, showing only as many results per page as I have set in the "reading" settings in the WP admin section.

          I'm basically looking to achieve something similar to the model sections on this site: babesandstars.com

          You click each letter, it shows a set amount per page, and an image with the name.
          www.tittytweaker.com

          Comment

          • Tittytweaker
            Confirmed User
            • Dec 2012
            • 184

            #6
            Hmm. I seem to be over complicating this for myself. Basically, I need to just change this chunk of code:

            Code:
              <?php if(have_posts()) { ?>
            
                                
            
                                <h2 class="page-title"><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a><?php wp_title(); ?></h2>
            
                                
            
                                <?php while (have_posts()) : the_post(); ?>                    
            
                            
            
                                <div class="post" id="post-<?php the_ID(); ?>">
            
                                    
            
                                    <a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(array(180,240), array('alt' => get_the_title(), 'title' => '')); ?></a>
            
                                    
            
                                    <div class="link"><a href="<?php the_permalink() ?>"><?php short_title('...', '26'); ?></a></div>
            
                                    
            
                                    <span>Added: <?php the_time('F j, Y'); ?></span>
            
                                    
            
                                    <span><?php
            
            
            
            $model_list = get_the_term_list( $post->ID, 'model', 'Model: ', ', ', '' );
            
            
            
            // Output taxonomy information if there was any
            
            
            
            if ( '' != $model_list ) {
            
            echo $model_list;
            
            } // endif
            
            
            
            ?></span>
            This is what causes the pages to display the posts. Basically, I just need to change it so that it brings up each model instead of each post - snagging a picture with the same name as the term slug from a folder, and displaying the models name underneath. I can go through and work all the css after that.

            I appreciate the assistance. It's tough, I know what I intend to do, I just don't know the proper terms to research to figure out how it's done.
            www.tittytweaker.com

            Comment

            • Tittytweaker
              Confirmed User
              • Dec 2012
              • 184

              #7
              Scratch the last post, I managed to fix that.

              Still, I haven't found a way to display one letter at a time from the taxonomy.

              Anyone know a solution to that?
              www.tittytweaker.com

              Comment

              • gracesfall
                Confirmed User
                • Sep 2013
                • 252

                #8
                You could try something like this:

                Create a page template for each letter of the alphabet (e.g. a-page.php, b-page.php, etc...). The loop on each page would look something like this:

                PHP Code:
                <ul class="posts">
                         <?php 
                         global $wpdb; 
                         $request = "a" [B]// could be any letter you want[/B]
                         $results = $wpdb->get_results(
                                "
                                SELECT * FROM $wpdb->posts
                                WHERE post_title LIKE '$request%'
                                AND post_type = 'post'
                                AND post_status = 'publish'; 
                                "
                         ); 
                         if ( $results ) 
                         {
                            foreach ( $results as $post ) 
                            {
                                setup_postdata ( $post ); 
                                ?> 
                                <li>
                                    ... loop stuff here (the_title, the_permalink) ... 
                                </li>
                                <?php 
                            }
                         } 
                         else 
                         {
                            ?> 
                            <div class="alert">No models found for that letter. Please try again, or use the search at the top.</div>
                            <?php
                         }
                         ?>
                    </ul>
                Then in your page manager, create a page for each letter and assign the corresponding page template to that page.
                -= gracesfall =-

                FreeLesbianPornBlog.com
                Follow me on Twitter: https://twitter.com/gracesfall
                Like me on Facebook: Free Lesbian Porn Blog
                Hit me up on ICQ: 663050376

                Domains for Sale: DaddyWhoreBucks.com | YoungAndFuckable.com | KnobGobblers.com

                Comment

                Working...