• Is it possible to add a post to a page? What I would like to do is to have separate sections for each category. Please see my site to understand what I mean.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Chad

    (@lynneandchad)

    The link Esmi posted should help… The only drawback is having to add a conditional statement for each category. You could always try creating a page template with the following:

    <?php
     $selected_cat = the_title('','',false);
     $selected_cat = str_replace(" ", "-", $selected_cat);
    ?>

    and then just before the loop begins:

    <?php query_posts('category_name=' . $selected_cat); ?>

    If you make sure your page names match your category slugs, this should pull them in the way you want.

    It grabs the name of the page being displayed, then converts all of the spaces into hyphens, so it looks like a URL slug. It then filters posts based on that slug.

    Note: using characters other than letters and numbers in your page/categories names would cause problems 🙂

    Good luck!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Adding Posts to a Page?’ is closed to new replies.