0

I'm working on a client project and they would like to use posts much like we would traditionally use pages due to there being a limited number of pages one WordPress install can handle and the ability to categorize posts more efficiently.

The problem I'm running into is the client would like there to be child posts for each post, much like a child page. I have to be able to both title the child posts and present them in a menu on the parent post and child posts of the parent (the same menu on both the parent and child post).

I considered wp_link_pages, but that does not allow a menu of child posts nor real titling of each child post.

I hope somebody has a solution they may be willing to share.

1

Use pages for pages and posts for posts. Both post types are specialized for their use case. They use different permalink settings and list tables.

The number of pages is not limited. I have seen site with more than 50.000 pages running smooth.

In earlier days, the permalink parsing for pages was slow under some circumstances, but that has been solved long ago (by @Otto, if I remember that correctly).

You can use categories, tags or custom taxonomies on pages too.

A simple example demonstrating how to let pages act more like posts:

add_action( 'wp_loaded', 't5_page_enhancements' );

/**
 * Excerpts and tags for post type 'page'.
 *
 * @wp-hook wp_loaded
 * @return  void
 */
function t5_page_enhancements()
{
    add_post_type_support( 'page', 'excerpt' );
    register_taxonomy_for_object_type('post_tag', 'page');
    add_filter( 'pre_get_posts', 't5_add_pages_to_tax_query' );
}

/**
 * Let WP search for post type 'page' on tag archives.
 *
 * @wp-hook pre_get_posts
 * @param   object $query
 * @return  object
 */
function t5_add_pages_to_tax_query( $query )
{
    if ( ! is_main_query() or ! is_tag() )
        return $query;

    $query->set( 'post_type', array ( 'page', 'post' ) );

    return $query;
}
  • At one point a great deal of pages led to an extremely slow site - I haven't heard of any change, has there been? – AndrettiMilas Jan 8 '13 at 22:16
  • @siouxfan45 See my update. The permalink performance problems have been solved some versions ago. – fuxia Jan 8 '13 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.