• Hi, I am designing a custom theme and I would like to create a page named “Blog” where I will display only blog posts. I’ve created a category named “blog” and would like them to be displayed on the “Blog page”.

    What would be the best way to accomplish this.

    Thank you, I appreciate any help.

    Nicho

Viewing 1 replies (of 1 total)
  • Your “blog” page will need to have a custom wordpress loop which queries posts belonging to the “blog” category.

    For example:

    <ul>
    <?php
    $blog_query = new WP_Query("cat=18&showposts=3");
    $wp_query->in_the_loop = true;
        while ($blog_query->have_posts()) : $blog_query->the_post(); ?>
            <li>
                <span class="date">Posted: <?php the_time('F jS, Y') ?></span>
                <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
                <p><?php the_excerpt(); ?></p>
            </li>
    <?php endwhile; ?>
    </ul>

    In the above example pay special attention to cat=18&showposts=3 the 18 should be replaced by the category id number of your blog category and you can remove or change the 3 to how many posts you want to show.

    Hope that helps.

    Aaron

Viewing 1 replies (of 1 total)
  • The topic ‘WordPress pages…’ is closed to new replies.