WordPress.org

Ready to get started?Download WordPress

Forums

Custom post types? (2 posts)

  1. Arterus
    Member
    Posted 1 year ago #

    Hi all,

    I have a friend with dementia, because of his condition I want to make his current wordpress blog as simple as possible for him, but dont quite know how to go about it.

    I want a custom post type for

    Poems
    Videos
    Photo's
    Books

    So he can just click on one of them and copy paste what he wants. (like creating a new page but obviously creating a new poem, book entry, video etc...)

    What I dont know how to do, is make all that content he posts go to the relevant page.
    Example: He clicks to create a new 'photo' he uploads his photo, types his text, then when he hits 'update' that photo joins all the other photo's on the 'photo's' page. (which is selectable from a 'photo's Nav Bar item)

    I'm sure I'm explaining this badly.. I am finding it hard to explain properly.

    Hopefully someone can decipher what I am trying to ask :)

    Thanks in advance all,

    Art

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    YOu need to set has_archive when registering the post type
    http://codex.wordpress.org/Function_Reference/register_post_type#Parameters
    You can then make a custom URL tab on a custom menu (or a dummy page redirected using the 'page links to' plugin if you don't use a custom menu) pointing to the archive URL for you CPT, usually domain.com/CPT_slug, unless you do a rewrite when registering the post type

    Which turns on the ability to list each CPT on it's own page

    You then would make 2 files per CPT - one akin to index.php (might even be a copy of it) named archive-post_type.php and one like single.php named single-post_type.php which displays the single view of the CPT.

    You may not need all of those files, as single.php will display a single view of a CPT, it's just up to if you need custom layouts for each post type.

    http://codex.wordpress.org/Template_Hierarchy#Custom_Post_Types_display
    http://codex.wordpress.org/Template_Hierarchy#Single_Post_display

    Hopefully the links I gave here will provide any of the detail I glossed over

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.