Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter icarus313

    (@icarus313)

    Thanks, Otto42 !

    I’ve been reading your responses…
    and i’ve learned a lot.

    These will work better with cat__* in 2.7 though. Might consider upgrading now instead of later.

    I definitly want to upgrade asap, but not sure how to get to upgrade to 2.7? don’t see it in beta.

    thnaks

    Thread Starter icarus313

    (@icarus313)

    thanks, I appreciate any help.
    And you are correct, the cat=-14, code was a inelegant and ineffective method for preventing duplicates.
    I’ve since stepped back, and removed the feature category, and created a tag=fresh.
    As well as got the $do_not_duplicate variable to work.

    Now my problem is that to get the desired effect, I have to add an offset=1 parameter, to ONLY the category that happens to have the post with the tag=fresh, otherwise I lose a post in one or both of the category loops.

    I know I’m over thinking and/or overcoding, but i’m coming from actionscript and xml , and new to php.

    I really just want to:
    1. grab 10 of the most recent posts (admin setting)
    2. from the 10 posts extract the latest post tagged = fresh
    3. style that extracted post <div id=”fresh”>
    4. with the remaining 9 posts extract the 3 most recent posts in category = style
    5. style those 3 posts <div id=”mystyle”>
    6. with the remaining 6 extract the 3 most recent posts in category = music
    7. style those 3 posts <div id=”mymusic”>
    8. with the reamining posts, eiter ignore or list on sidebar

    I could do this with Actionscript and XML, i’mjust having trouble grasping how to do this in WP (without a plugin)

    I’ve since implemented:

    <?php $temp_query = clone $wp_query; ?>
    	 <?php $my_query = new WP_Query('tag=fresh&showposts=1');
    	 	while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate[] = get_the_ID(); ?>
    <!-- displaying the latest post tagged "fresh" -->
    			<?php the_title(); ?>
    			<?php the_excerpt(); ?>
    	 <?php endwhile; ?>
    <!-- here is loop for cat=11 minus the post stored in variable $do_not_duplicate -->
    
    <?php $temp_query2 = clone $wp_query; ?>
    <?php $my_query2 = new WP_Query('showposts=3&cat=11&offset=1');
    while ($my_query2->have_posts()) : $my_query2->the_post();
    if (array_search(get_the_ID(), $do_not_duplicate) !== false)
    continue; update_post_caches($posts); ?>
    <!-- STyle Style -->
    <?php the_title(); ?>
    <?php the_excerpt(); ?>
    <?php endwhile; ?>
    // now back to our regularly scheduled programming
    <?php $wp_query = clone $temp_query2; ?>
    
    	<?php $temp_query3 = clone $wp_query; ?>
    <?php $my_query3 = new WP_Query('showposts=3&cat=10);
    while ($my_query3->have_posts()) : $my_query3->the_post();
    if (array_search(get_the_ID(), $do_not_duplicate) !== false)
    continue; update_post_caches($posts); ?>
     <!-- category = music  -->
    <?php the_title(); ?>
    <?php the_excerpt(); ?>
    <?php endwhile; ?>
    // now back to our regularly scheduled programming
    <?php $wp_query = clone $temp_query3; ?>

Viewing 2 replies - 1 through 2 (of 2 total)