[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 20:28:12 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: Future Release
Component: Customize | Version: 4.7
Severity: normal | Resolution:
Keywords: needs-patch | Focuses:
--------------------------+-----------------------------
Changes (by westonruter):
* keywords: => needs-patch
* version: trunk => 4.7
* milestone: Awaiting Review => Future Release
Old description:
> 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!
New description:
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
<?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!
--
Comment:
Good call. Yes, this makes great sense.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/40807#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list