Viewing 8 replies - 1 through 8 (of 8 total)
  • I suggest you make “Activities” a category.

    Create a page “Activities-content”.

    Create the category “Activities”.

    Create a “category-aa.php” file in your theme folder. (“aa” is the id of the “Activities” category)

    Copy the content of the file that outputs your pages (see http://codex.wordpress.org/Template_Hierarchy ) in “category-aa.php”.
    Above the loop (see http://codex.wordpress.org/The_Loop ) place
    <?php query_posts('page_id=xx');?>
    (“xx” is the id of “Activities-content” page)

    Be sure to exclude from menus the “Activities-content” page

    Hope it helps

    Thread Starter kjfrank

    (@kjfrank)

    Silafu,
    Thanks for your help… it seems like a lot of trouble to solve such a basic problem, but it did the trick.
    Thanks!

    Thread Starter kjfrank

    (@kjfrank)

    oops… spoke to soon.

    now I have posts showing up under my page content that are from a subcategory of that page:

    example: I have the “Activities” category page pulling in the static content from the “Activities-content” page using your method described above. However now posts are showing up under that static content that are from a category that is a child of activities.???? can’t figure out why. I tried modifying the query_posts like so:
    <?php query_posts('page_id=475'.'&cat=-33,-31,-37');?>
    to try and exclude the categories that the posts belong to but no luck, the posts keep showing up. Any Ideas?

    Thanks for any help you can offer.

    Post here please the content of category-aa.php.

    Thread Starter kjfrank

    (@kjfrank)

    Silafu,
    I just added the conditional:
    <?php if (!in_category('31') && !in_category('33')) { ?>
    within the loop as you will see in the code below.
    This does work now but I’d rather modify the query to return the correct result set rather than filter the posts after retrieving them.

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Thanks again for your help.

    Keith

    Try replace all that with this:

    <?php get_header(); ?>
    <div id="content-body">
    <?php if ( function_exists('yoast_breadcrumb') ) { yoast_breadcrumb('<p id="breadcrumbs">','</p>'); } ?>
    <h1>Activities/h1>
    <?php $my_query = new WP_Query('page_id=457'); while ($my_query->have_posts()) : $my_query->the_post(); ?> 
    
      		<?php the_content('');?>
         	 <?php endwhile; ?>
    </div>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    Should work as expected if put it in category-activities.php

    Or is there something that i don’t understand 🙁

    Thread Starter kjfrank

    (@kjfrank)

    Worked perfectly!!!

    What I was not understanding was how to reset the query as you did with:

    new WP_Query('page_id=457')

    and looking at my old code I assume I was referencing the default query in the loop by using:

    (have_posts()) : while (have_posts()) : the_post();

    instead of:

    ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post();

    Thanks so much for your help.

    Cheers,
    Keith

    Welcome!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Page name and Category name are the same… url breaks’ is closed to new replies.