WordPress.org

Ready to get started?Download WordPress

Forums

Static page that's not the index (20 posts)

  1. vsp
    Member
    Posted 8 years ago #

    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.

  2. vsp
    Member
    Posted 8 years ago #

    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.

  3. ryoken
    Member
    Posted 8 years ago #

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

  4. vsp
    Member
    Posted 8 years ago #

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

  5. vsp
    Member
    Posted 8 years ago #

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

  6. schulte
    Member
    Posted 8 years ago #

  7. ryoken
    Member
    Posted 8 years ago #

    PHP-Exec is another option

  8. vsp
    Member
    Posted 8 years ago #

    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>

  9. vsp
    Member
    Posted 8 years ago #

    bump

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

  10. schulte
    Member
    Posted 8 years ago #

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

  11. vsp
    Member
    Posted 8 years ago #

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

  12. schulte
    Member
    Posted 8 years ago #

    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>

  13. vsp
    Member
    Posted 8 years ago #

    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

  14. schulte
    Member
    Posted 8 years ago #

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

  15. ryoken
    Member
    Posted 8 years ago #

    possibly its an issue with your page.php template?

  16. vsp
    Member
    Posted 8 years ago #

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

  17. vsp
    Member
    Posted 8 years ago #

    this would probably be a lot simpler if i could just make almost an exact copy of the site's index page and have php work on it instead of trying to implement code on a wordpress Page. does anyone know how i can do this? i know all the code, im just not sure how to get php to work on the new page.

  18. vsp
    Member
    Posted 8 years ago #

    does anyone have any other ideas on this issue?

  19. schulte
    Member
    Posted 8 years ago #

    Ask over in the WordPress irc channel -- http://codex.wordpress.org/irc

  20. vsp
    Member
    Posted 8 years ago #

    bump one more time, since I can't seem to get any help on IRC

Topic Closed

This topic has been closed to new replies.

About this Topic