Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8907621
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:57:53+00:00 2026-06-15T02:57:53+00:00

Would this be the best way to 1. Display the content for the page

  • 0

Would this be the best way to
1. Display the content for the page
2. Under page content display all posts (or thumbnails from posts) from a specific category

Forgive me if my code is sloppy. If there is a better way to do this, I am very eager to learn. There will probably be 30+ categories when the site is completed.

<?php get_header(); ?>

<div id="outerWrapper">
  <div id="pageContent">

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <h2>
      <?php the_title(); ?>
    </h2>
    <?php the_content(); ?>
    <?php endwhile; endif; ?>

    <?php query_posts('category_name=cold-casting'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="pages"> <a href="<?php the_permalink(); ?>">
      <?php the_post_thumbnail(); ?>
      </a> </div>
    <?php endwhile;?>
    <div class="clear"></div>
  </div>
</div>

<?php query_posts('category_name=casting'); ?>
<?php while (have_posts()) : the_post(); ?>
<div class="pages"> <a href="<?php the_permalink(); ?>">
  <?php the_post_thumbnail(); ?>
  </a> </div>
<?php endwhile;?>

<div class="clear"></div>
</div>
</div>

<?php get_footer(); ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T02:57:55+00:00Added an answer on June 15, 2026 at 2:57 am

    You should use wp_query instead, It gives cleaner code IMO. But either way, you don’t have to have two different loops for the categories, you could just send in both of them at once.

    query_posts(‘category_name=cold-casting,casting’);

    And as Nikola said, add a wp_reset_query(); after your custom queries.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In a single paged application, would this be the best way to bind and
I've been wondering what the best way to do this would be. I've got
Wondering what the best / good way of doing this would be in jQuery.
What would be the best way to something like this where a timestamp is
How best would I exclude results from #other_section, given a structure like this? <form>
What would be the best approach to display footnotes for FlowDocument content in a
Whats the best way to transfer data between the master page and the content
What is the best way to display information from related objects on my Backbone.js
I have a page which renders html content from the database. Now I would
What would be the best algorithm to solve this problem? I spent a couple

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.