baalinato
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Forum: Developing with WordPress
In reply to: loops inside the loopthanks a lot binh for ur interest.
hi from montreal to vietnam.Forum: Developing with WordPress
In reply to: loops inside the loopi tried urs and i had to change the 3 for a 4 to make it work. seems longuer. maybe an illusion.
here’s a demo : https://baa-li.com/test/photos1/
the code on the template category :
<?php get_header(); ?> <!-- photo1 cat --> <div id="content" class="catphotos"> <?php $my_query = new WP_Query('category_name=photos1&p=4'); while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate = $post->ID; ?> <div class="small1"> <h2>Photos 1</h2> <div class="spaceit"></div> <div id="post-<?php the_ID(); ?>"> <div class="entry"> <?php the_content(''); ?> <?php edit_post_link('Edit', '<p>', '</p>'); ?> </div> </div> </div> <?php endwhile; ?> <div class="small4"> <?php if (is_category('photos1')) {query_posts ('category_name=photos1');} ?> <?php if (have_posts()) : while (have_posts()) : the_post(); if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?> <div class="post" id="post-<?php the_ID(); ?>"> <div class="entry"> <?php the_content(''); ?> <?php edit_post_link('Edit', '<p>', '</p>'); ?> </div> </div> <div class="spaceit"></div> <?php $count++; $y = 4; $r = fmod($count, $y); if ($r==0) { echo '</div><div class="small4">'; } ?> <?php endwhile; endif; ?> </div> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
Forum: Developing with WordPress
In reply to: loops inside the loopI found the answer
<div class="small4"> <?php if (is_category('photos1')) {query_posts ('category_name=photos1');} ?> <?php if (have_posts()) : while (have_posts()) : the_post(); if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?> <div class="post" id="post-<?php the_ID(); ?>"> <div class="entry"> <?php the_content(''); ?> <?php edit_post_link('Edit', '<p>', '</p>'); ?> </div> </div> <div class="spaceit"></div> <strong><?php $count++; $y = 4; $r = fmod($count, $y); if ($r==0) { echo '</div><div class="small4">'; } ?></strong> <?php endwhile; endif; ?> </div>
Viewing 3 replies - 1 through 3 (of 3 total)