Can someone please help me with this Multiple loop and categories please?
-
I have had the hardest time trying to figure something out, I have poured thru the codex and php learning sites for the last 4 weeks and have not been able to get this to work. Can someone please look at what I am trying to do and see if you can offer a solution please? lol. Ugh… ok here goes.
>Basically I have a page (single.php type)that displays the content of a post about a guy or girl who is an agent. The content will be a post about the agent, kind of like a bio. I have some portfolio code that handles this for me and outputs the info about him using “the_content”.
>The agent will have many posts that he (me really, but “he” for the sake of argument) has posted. The agents names will be used for the category for his posts.
>So my single page for the agent bio will have “the-content” of the agents bio post along with some other goodies I have added using custom post types which works well so far.
> so under this info, I need to output all of the posts in his category like a list. It needs to include a thumbnail of the post and the excerpt.
Here is a very basic and bad code example of what I have been trying to do, just as an example
Start off getting the post content for this person... <?php if ( have_posts() ) { while ( have_posts() ) { the_post(); // <?php the_content() ?> //Post Content here // } // end while } // end if ?>
>then in a seperate div I want to list his posts based upon the >category of his or her name depending upon whos bio is being looked >at , something like this
<?php query_posts('category_name=work&showposts=5'); ?> <strong><em>//cat name will need to be variable</em></strong> <ul> <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2> <small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?></small>\ <div class="entry"> <?php the_excerpt(); ?> </div> <?php endwhile; ?> </ul> <?php endif; ?>
I hope this is not too confusing, any ideas?
- The topic ‘Can someone please help me with this Multiple loop and categories please?’ is closed to new replies.