WordPress.org

Forums

Page Templates (4 posts)

  1. villpicker
    Member
    Posted 4 years ago #

    This is my first website with WordPress, but I have experience with css and php already.

    I am making a site that requires bios for 6-8 people each of which will have their own page. I want to have a template so each page looks similar. All I need is a content area and then a widget area for adding a photo and some additional info.

    So far the only way I see this can be done is to duplicate the default template for each bio page, create a new widget area for each page, and then load the widget into each template.

    Is there a quicker way?

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    A single custom page template and some custom fields for the person-specific data.

  3. Devin Price
    Member
    Posted 4 years ago #

    You'd just need to create one page template and you can apply it all those pages.

    http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates

    If the sidebar content is going to be the same, you'd just need to register one additional widget area, and call that from you page template.

    I'd say that's the simplist way to do it.

    --

    If you want to try another more advanced route, you could use custom post types:

    http://codex.wordpress.org/Custom_Post_Types

    To do that, you would add something like this to your functions.php:

    add_action( 'init', 'create_post_type' );
    
    function create_post_type() {
      register_post_type( 'bios,
        array(
          'labels' => array(
            'name' => __( 'Bios' ),
            'singular_name' => __( 'Bios' )
          ),
          'public' => true
        )
      );
    }

    Then you could create a template called single-bios.php that it would use.

    The downfall is that there is no multiple template yet (to display all your bios on one page). But that should be out shortly in WordPress 3.1, and then you would just need to create a template called: archive-bios.php.

    This might be a more interesting route if you needed add extra metaboxes for data about each person who has a bio, or use additional taxonomies.

    If any of that is confusing, just go back up to option 1. :)

  4. villpicker
    Member
    Posted 4 years ago #

    Thanks for the response. It looks like the custom field is what I need to use.

Topic Closed

This topic has been closed to new replies.

About this Topic