Support » Fixing WordPress » Static page that’s not the index

  • I want to create a ‘category’ page that actually displays the posts from 3 categories. I am already doing the same thing on the front page, but with fewer posts. So I already have the code, I just am not sure how to make a page that does this. I tried entering the code into a Page but it didnt work. if anyone has ideas i’d appreciate it.

Viewing 15 replies - 1 through 15 (of 19 total)
  • I hope my question is being understood. What I want to do is to create a page that’s not the front page that displays like a category archive, except of 3 differnt categories put together. I hope this helps.

    Are you using a plugin that allows pages to execute php? If not, look in the codex for one.

    that sounds like just the thing. i’m looking for it now, but if anyone knows a good plugin i would like a link.

    I got the plugin RunPHP, but it doens’t seem to be working. does anyone have any suggestions?

    PHP-Exec is another option

    im using PHP-Exec, and it’s working, except a weird thing is happening. it is just supposed to display post titles, which it’s doing, but under all the titles it is displaying all the posts. take a look: http://70.103.140.131/~cohaorg/?page_id=160

    here’s my code if anyone would be kind enough to take a look:

    <phpcode>
    <?php query_posts('cat=2,18,15'); ?>
    <?php if (have_posts()) : ?>
    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="post">
    <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    <h5>By <?php
    $custom = get_post_custom_values('Author');
    if (count($custom) != 0)
    {
    // do your thing
    echo $custom[0];
    // maybe do more things
    } ?>
    </h5>
    <small><?php the_time('l, F jS, Y') ?></small>
    </div>
    <?php endwhile; ?>
    <?php else : ?>
    <h2 class="center">Not Found</h2>
    <?php include (TEMPLATEPATH . '/searchform.php'); ?>
    <?php endif; ?>
    </phpcode>

    bump

    [Do not bump after 45 minutes – or you’ll get banned/suspended! (mod)]

    Looks like the loop is still pulling the posts after your PHP code…

    why would it be doing that when i didnt call in the loop?

    What happens when you remove the if/else statement?

    <phpcode>
    <?php query_posts('cat=2,18,15'); ?>
    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="post">
    <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    <h5>By <?php
    $custom = get_post_custom_values('Author');
    if (count($custom) != 0)
    {
    // do your thing
    echo $custom[0];
    // maybe do more things
    } ?>
    </h5>
    <small><?php the_time('l, F jS, Y') ?></small>
    </div>
    <?php endwhile; ?>
    </phpcode>

    it’s still doing the same thing. i know the code should work , because it’s the same code im using on my front page

    Is that all that’s on the page? Just that PHP?

    possibly its an issue with your page.php template?

    i dont think it’s an issue with page.php because none of the other pages have this problem. does anyone have an idea?

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Static page that’s not the index’ is closed to new replies.