WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Category of pages content on one page (5 posts)

  1. micasuh
    Member
    Posted 5 years ago #

    I have a page called one.
    I have a category called numbers.
    Numbers has a total of 6 pages tagged for this category.

    I'd like to have all the content of the category numbers on the page called one. Not just titles, but content also.

    So, if I go to /one/, I would see the content from all 6 of those pages.

    Is this possible?

  2. MichaelH
    Member
    Posted 5 years ago #

    Before starting please note, Pages do not have categories, but Posts do. I will mainly refer to Pages below. Also note my example assumes you are using the WordPress Default Theme and that you have 6 POSTS assigned to a category called Numbers. I'll assume Numbers is category ID 3.

    Copy wp-content/themes/default/archive.php to wp-content/themes/default/onefront.php.

    Edit onefront.php and change:

    <?php
    /**
     * @package WordPress
     * @subpackage Default_Theme
     */
    
    get_header();
    ?>

    to

    <?php
    /*
    Template Name: OneFront
    */
    ?>
    
    <?php get_header(); ?>

    and change:

    <?php while (have_posts()) : the_post(); ?>

    to

    <?php query_posts ($query_stingw . '&cat=3'); ?>
    <?php while (have_posts()) : the_post(); ?>

    Add a new Page called One. Add a new Page and called Blog. In Administration > Settings > Reading, set the Front page displays to A static page, and select One for Front page:, and select Blog for the Posts page.

    Enjoy!

    Related:
    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy

  3. micasuh
    Member
    Posted 5 years ago #

    Wow, thank you MichaelH! But, I was mistaken in my post because I wasn't thinking about the category thing.

    What I really DO want is the content of several pages in one post. Lemme revise what I said.

    I'd like to have the content of child pages of a parent page to show up in the parent page.

    So, once again, for example:
    I have a page called one.
    This parent page has 6 child pages.
    <p>I'd like to have all the content of the child pages on the parent page. Not just titles, but content also.</p>

    <p>So, if I go to /one/, I would see the content from all 6 of those child pages as well.</p>

  4. MichaelH
    Member
    Posted 5 years ago #

  5. micasuh
    Member
    Posted 5 years ago #

    Perfect! That's exactly what I needed and it worked like a charm. Thanks MichaelH!

Topic Closed

This topic has been closed to new replies.

About this Topic