• I have a page template that I only want to show posts that are in a certain category. Is something like this possible, if so how?
    Right they are showing on my home page only, I want this category to only show on my new template page and not my home page.

    thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • Try reviewing a page of posts.

    Thread Starter csharpcoder

    (@csharpcoder)

    I just tried it and its not showing the posts for the category I specified.

    Is there something else I have to do with it? I created a post, assigned it to my category, assinged a test post page to my page template, and the post isn’t showing

    What arguments are in your custom query?

    Thread Starter csharpcoder

    (@csharpcoder)

    This is my first WP site, so bear with me. 🙂

    The page i’m using has this to pull back the posts:[I have HTML wrapped around the output, but these are what’s getting the posts]

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php  if (in_array($post->ID, $do_not_duplicate)) continue;?>
    
    <?php wpe_excerpt('wpe_excerptlength_index', ''); ?>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    I just want posts that are in the [AA] category. [slug=aa]

    If you re-read the page I linked to above, you will see that you need a custom query along the lines of:

    $args = array(
                // Change these category SLUGS to suit your use.
                'category_name' => 'music, videos',
                'paged' => $paged
            );
    $list_of_posts = new WP_Query( $args );

    The category name/slug will vary according to your needs.

    Thread Starter csharpcoder

    (@csharpcoder)

    yeah i added that and nothing came out, i’m working on rebuilding my template page line my line

    Thread Starter csharpcoder

    (@csharpcoder)

    i got it working, thanks, took some time to tweak my HTML to work with it, but i got it working,

    thanks for your assistance

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘show posts by category on page template’ is closed to new replies.