• Hi all!

    First of all, sorry for my confusing title (if it confused you) but the forum keeps cutting it in half.
    Secondly, this is my first post (woot!).

    Alright, lets get back to business:
    Unfortunately I have a hard time trying to define/explain what exactly I need help with, thus I will use images and descriptive text to explain what I am trying to do..

    I have set up several custom taxonomies to organize a resume.
    This is the basis as of right now:

    Department (where on the resume?)
    --Experience
    --Education
    --Profile
    --Add extra
    
    Organization (what company / school?)
    --Organization 1
    --Organization 2
    --Add extra
    
    Time Period (How long?)
    --Add

    This is what I am trying to create:
    http://imageshack.us/photo/my-images/585/righty.jpg/
    However it looks like this:
    http://imageshack.us/photo/my-images/204/notright.jpg/

    I hope your seeing my problem / issue here..

    Here is the current code:
    http://pastebin.com/jQdfvgJ3

    As you see I currently have two loops, one for the education department and one for the experience department. And this solves the problem / achieve the results I want.. however if I would add another department I will have to add another loop..
    What I am trying to do is create the same effect without adding extra loops, each time.

    Hopefully this makes sense.
    Thanks in advanced,
    Ruud

    Btw, I did find a post that had a similar problem / solution but I can’t find it anymore.

    EDIT01:
    I found the post I talked about above:
    http://wordpress.org/support/topic/dynamic-variable-for-custom-taxonomy-in-loop?replies=16

    However, this code (after adjusting to my taxonomies):

    <!-- BEGIN CODE FOR PRODUCT AREA -->
       <?php $prod_cats = get_terms('product_cat');
       foreach ($prod_cats as $prod_cat) {
          $cat_name = $prod_cat->name; ?>
    		<div id="products">
    		<!-- post begin -->
    		<?php $loop = new WP_Query( array( 'post_type' => 'product_listing', 'posts_per_page' => 4, 'product_cat' => $cat_name ) ); ?>
    		<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    		<div class="product-tease" id="post-<?php the_ID(); ?>">
    			<div class="upper">
    				<h3><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
    				<p align="center"><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><img src="<?php echo catch_that_image() ?>" /></a></p>
    				<?php the_excerpt('Read the rest of this entry »'); ?>
    			</div>
    			<span class="btn-readon"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">Read On</a></span>
    			</div>
    		<?php endwhile; ?>
    		<br clear="all" />
    		<!-- post end -->
    		<br clear="all" />
    		  <?php wp_reset_query(); ?>
    		  <?php rewind_posts(); ?>
    		</div>
       <?php } // End foreach $prod_cats ?>

    does not work, it only shows one department.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter MeRuud

    (@meruud)

    Here the code if I integrate it with the code from the other post:

    <?php $prod_cats = get_terms('department');
       foreach ($prod_cats as $prod_cat) {
          $cat_name = $prod_cat->name; ?>
    
       					<?php $loop = new WP_Query( array( 'post_type' => 'resume', 'department' => $cat_name ) ); ?>
       					<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
    					<div class="yui-gf">
    						<div class="yui-u first">
    							<h2><?php echo get_the_term_list( $post->ID, 'department', '', ' ', '' ); ?></h2>
    						</div><!--// .yui-u -->
    						<div class="yui-u">
    								<div class="job">
    									<h2><?php echo get_the_term_list( $post->ID, 'organization', '', ' ', '' ); ?></h2>
    									<h3><?php the_title(); ?></h3>
    									<h4><?php echo get_the_term_list( $post->ID, 'timeperiod', '', ' ', '' ); ?></h4>
    									<p><?php the_content(); ?></p>
    								</div>
    						</div><!--// .yui-u -->
    					</div><!--// .yui-gf -->
    					<?php endwhile; ?>
    					<br clear="all" />
    					<br clear="all" />
    		 			<?php wp_reset_query(); ?>
    		  			<?php rewind_posts(); ?>
    		  			<?php } ?>

    Which also results in this:
    http://imageshack.us/photo/my-images/204/notright.jpg/
    and thus not what I am trying to achieve..

    Thanks in advanced,
    Ruud

    Edit01:
    Not sure if this will help but
    http://imageshack.us/photo/my-images/854/defb.jpg/

    Blue =

    <div class="yui-u first"> </div>
    contains "Department"

    Yellow =

    <div class="job"> </div>
    contains "Organization", "Post Title", "Post Description", "Time Period, and a bottom line"

    Green =

    <div class="yui-u"> </div>
    contains Yellow

    Red =

    <div class="yui-gf"> </div>
    contains all, including a line on the top

    And thus what I am trying to achieve is that there will be one Red per department and Yellow will repeat for post in that department (instead of one Red per Post)

    Edit02:
    I realize that I posted it in the wrong fora.. sorry about that

    Thread Starter MeRuud

    (@meruud)

    Here is the whole page:
    http://pastebin.com/xhDFvdJq

    Short file description (mainly irrelevant for this, but might clarify the code)

    Line 1 - 9: File description / recognition.
    Line 11 - 106: Javascript Code (not really relevant here, will be replaced with external .js file)
    Line 117 - 130: define post meta data
    First loop starts at line 116

    Second loop, and the one I am talking about in the previous posts starts at line 237, which can also be found here http://pastebin.com/UXLDN1gn or the original version (with one loop for one category) can be found here http://pastebin.com/jQdfvgJ3

    Thanks,
    Ruud

    Thread Starter MeRuud

    (@meruud)

    Anybody please?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Dynamically restart div based on taxonomy’ is closed to new replies.