Viewing 6 replies - 1 through 6 (of 6 total)
  • Michael

    (@alchymyth)

    i don’t think that a category template will keep its ‘query’ when used as a page template;

    if used as a page template, you might need to add a custom query before the loop.

    and simply remove / or don’t add any ‘comments_template()’ code.

    mheltone

    (@mheltone)

    <?php query_posts('category_name=k9forsale&post_per_page=30'); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    // contents here
    
    <?php endwhile; ?>
    <?php endif; ?>
    <?php wp_reset_query(); ?>

    Try this codes.

    Thread Starter AardvarkGirl

    (@aardvarkgirl)

    If you guys have a better path then the one I am going down, by all means share… 🙂 I really have no idea and headed into this blindly 🙂

    All I know is, I have a menu item (in the main menu system) that I need to go to a ‘page’ (or a list of posts, or however you want to word it) and show all the posts from just one category.

    I figured there was more than one road to China… I just picked one and started going. 😉

    I’ll give the code above a try (really, I am a total newbie to this, I need to take some tutorials on PHP and databases).

    ++++ Came back to say, I used the code above and got nothing, so I probably did something silly. 😉

    Here is the URL:

    http://www.rastaging7.com/index.php/police-k9-training/k9forsale/

    So what other way would there be to accomplish what I want – keeping in mind I’ll be handing this over to the site’s owner (who is not going to be ultra savy, I want to keep things as simple for them as possible as far as keeping the ability for them to move pages around with in the menu, delete pages, add pages etc).

    Thanks folks so much! 🙂

    Thread Starter AardvarkGirl

    (@aardvarkgirl)

    Or… I know in the side bar widgets you can view ‘categories’ – how would I get ‘that’ up into the main menu (ie with out an actual ‘page’) – would you use a custom menu?

    A little learning is a dangerous thing. 😉

    mheltone

    (@mheltone)

    That’s weird that code usually works on me.
    Can you post your custom page here, So we can take a look.

    Thread Starter AardvarkGirl

    (@aardvarkgirl)

    mheltone-

    right now it is the (twenty ten theme’s) category.php, just renamed to ‘category-k9forsale.php’ (see code below, thats everything between the ‘content’ divs)… because as I admit, I’m green as grass. 🙂

    Again, if I am going about this the wrong way just say so. 😉

    <h1 class="page-title"><?php printf( __( 'Category Archives: %s', 'twentyten' ), '<span>' . single_cat_title( '', false ) . '</span>' );?></h1>
    
    <?php $category_description = category_description();
    if ( ! empty( $category_description ) )
    echo '<div class="archive-meta">' . $category_description . '</div>';
    
    get_template_part( 'loop', 'category' );
    ?>
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Category posts to page using custom page template’ is closed to new replies.