GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Webmaster Q & Fuckin' A (https://gfy.com/forumdisplay.php?f=27)
-   -   WP: Displaying taxonomy terms by first letter? (https://gfy.com/showthread.php?t=1119617)

Tittytweaker 08-28-2013 03:47 PM

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?

fendlestick 08-28-2013 04:38 PM

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

Tittytweaker 08-29-2013 12:15 PM

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?

fendlestick 08-29-2013 01:00 PM

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.

Tittytweaker 08-30-2013 02:48 PM

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.

Tittytweaker 08-30-2013 05:27 PM

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.

Tittytweaker 09-06-2013 09:46 AM

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?

gracesfall 09-25-2013 03:35 AM

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.


All times are GMT -7. The time now is 04:41 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123