0

This is my html structure. i want to display main page in left column which is column 6 and right and side 3 - 3 column which is same category and link with left page. i made page link relation with afc plugins so how can i display main page with link pages in single loop.


volunteering

We have placed hundreds of international volunteers from 17 to 76 years old from all over the world. [![


summer program - 2 weeks summer program - 3 weeks summer program - 3 weeks summer program - 2 weeks

https://i.stack.imgur.com/Q7TaE.jpg this is layout.

  • So you want to display the first post from the loop on the left side in 6-wide column and 4 other posts in two 3-wide columns on the right, is that what you have trouble with? – Greg36 May 4 '17 at 18:39
  • Yes, 4 other posts in two 3-wide columns on the right they are in same category. but left 6-wide column is main page of 4 others pages. and html code is not showing. – Umesh Shrestha May 4 '17 at 18:44
0

If you want to display the first post from the loop using a different HTML than the rest of posts in the loop just use a if/else statement.

$post_count = 0;

if ( have_posts() ) {

    /* Start the Loop */
    while ( have_posts() ) { the_post();

        if ($post_count == 0) {

            // Display 6-wide column
            // This will be executed just once for first post.

            $post_count ++;
        } else {

            // Display 3-wide posts
        }
    }
} else {
    // No posts
}

Is that the problem you encountered or did you mean something else?

  • Yes, Thank you very much. it works for me and for knowledge is it possible to use multiple loop in inside main query. – Umesh Shrestha May 5 '17 at 7:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.