Forums

please help - lost in the loop (9 posts)

  1. vschimel2
    Member
    Posted 3 years ago #

    please, please help - i'm trying to get a page to display 10 posts of a category 33. and i've had absolutely no luck (despite hours of trying!). any help would be so so so appreciated. here's the coding:

    <div id="gallery">

    <?php query_posts($query_string . '&cat=33'); ?>

    <div class="content">
    <?php if(have_posts()) : ?><?php while (have_posts()) : the_post(); ?>

    <div class="date">
    <?php the_date(''); ?>
    </div>

    <div class="title">
    <?php the_title(''); ?>
    </div>

    <div class="entry">
    <?php the_content(''); ?>
    </div>

    <?php endwhile;?>
    <?php endif; ?>

    </div>

  2. iridiax
    Member
    Posted 3 years ago #

  3. grn
    Member
    Posted 3 years ago #

    What result are you getting, for example an error message..?
    Also would be useful to know what the $query_string is..

    Anyway, try this:

    <?php query_posts($query_string . '&cat=33&posts_per_page=10'); ?>

  4. vschimel2
    Member
    Posted 3 years ago #

    thanks. all i'm getting on the screen is the title of the category & the date

  5. vschimel2
    Member
    Posted 3 years ago #

    now i'm getting the date & the category title only - here's the entire updated coding for the page. what am i missing???

    <?php get_header(); ?>

    <!-- Content Wrap -->
    <div id="galleryWrap">
    <!-- Gallery -->
    <div id="gallery">

    <?php if (is_page ()){ ?>

    <? } ?>

    <div class="content">

    <?php query_posts($query_string . '&cat=33&posts_per_page=10'); ?>

    <?php if(have_posts()) : ?><?php while (have_posts()) : the_post(); ?>

    <div class="date">
    <?php the_date(''); ?>
    </div>

    <div class="title">
    <?php the_title(''); ?>
    </div>

    <div class="entry">
    <?php the_content(''); ?>
    </div>

    <?php endwhile;?>
    <?php endif; ?>

    </div>
    </div><!-- [END] gallery content -->
    <?php get_sidebar();?>

  6. buddha trance
    Member
    Posted 3 years ago #

    Just in case... When you say page, do you mean that you are pasting that code directly into the page? That won't work.

    You should create a template with the code in there. Then create a new page from the admin dashboard and from the attributes select the template you created.

    http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates

    Hope this helps.

  7. grn
    Member
    Posted 3 years ago #

    From the code you've posted it looks you're missing a closing </div> tag at the end just before the get sidebar line. (Unless you've included this somewhere in the sidebar code...)

  8. vschimel2
    Member
    Posted 3 years ago #

    tried to add in a </div> tag and no luck
    so strange, right?
    i can't figure out what i'm missing. all that will display is the title of the category & the date the category was created
    (instead of the content, titles & dates of the posts in the categories)

    here's the coding again in case someone can help:

    <?php get_header(); ?>

    <!-- Content Wrap -->
    <div id="galleryWrap">
    <!-- Gallery -->
    <div id="gallery">

    <?php if (is_page ()){ ?>

    <? } ?>

    <div class="content">

    <?php query_posts($query_string . '&cat=33&posts_per_page=10'); ?>

    <?php if(have_posts()) : ?><?php while (have_posts()) : the_post(); ?>

    <div class="date">
    <?php the_date(''); ?>
    </div>

    <div class="title">
    <?php the_title(''); ?>
    </div>

    <div class="entry">
    <?php the_content(''); ?>
    </div>

    <?php endwhile;?>
    <?php endif; ?>

    </div>
    </div><!-- [END] gallery content -->

    <?php get_sidebar();?>

    </div><!-- [END] galleryWrap -->
    <?php get_footer(); ?>

  9. grn
    Member
    Posted 3 years ago #

    Where are you putting your code? Did you create the page template as buddha trance suggested?

Topic Closed

This topic has been closed to new replies.

About this Topic