[wp-trac] [WordPress Trac] #40807: Starter content: Allow for setting a "parent" for pages (and other hierarchical CPTs)
WordPress Trac
noreply at wordpress.org
Thu May 18 19:47:57 UTC 2017
#40807: Starter content: Allow for setting a "parent" for pages (and other
hierarchical CPTs)
--------------------------+-----------------------------
Reporter: webmandesign | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
From what I can see in
[https://developer.wordpress.org/reference/functions/get_theme_starter_content/
get_theme_starter_content()] function, it only allows for specific fields
to be set for posts: `post_type`, `post_title`, `post_excerpt`,
`post_name`, `post_content`, `menu_order`, `comment_status`, `thumbnail`
and `template`.
I would like to propose '''adding a `parent` field''' in there too for
hierarchical post types, such as Pages.
That way we can also create child pages (or sub-pages) in starter content,
such as:
{{{#!php
$starter_content = array(
'posts' => array(
'contact' => array(
'template' => 'page-templates/list-of-child-pages.php',
),
'contact-dublin' => array(
'post_type' => 'page',
'post_title' => 'Dublin Office Contact',
'post_content' => 'Page content here...',
'parent' => '{{contact}}', // <-- Here's the magic:
// Making this a child page of
our "Contact" page.
),
),
);
}}}
Thanks for consideration!
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40807>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list