#42612 closed defect (bug) (maybelater)
Single post navigation bugs when adding posts in Starter Content
Reported by: | bduclos | Owned by: | westonruter |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.7 |
Component: | Customize | Keywords: | has-patch |
Focuses: | Cc: |
Description
To reproduce the issue:
- Inside a fresh install of Twentyseventeen, open the functions.php file. Line 132, modify the $starter_content posts array to add 2 posts:
<?php 'posts' => array( 'home', 'about' => array( 'thumbnail' => '{{image-sandwich}}', ), 'contact' => array( 'thumbnail' => '{{image-espresso}}', ), 'blog' => array( 'thumbnail' => '{{image-coffee}}', ), 'homepage-section' => array( 'thumbnail' => '{{image-espresso}}', ), 'the-new-office' => array( 'post_type' => 'post', 'post_title' => 'The new office', 'thumbnail' => '{{image-espresso}}', 'post_content' => 'Maecenas tristique lobortis sem sit amet consectetur. Nullam pharetra ex ex, a aliquet ligula pellentesque a. Aenean et justo volutpat, malesuada purus a, sagittis eros.', ), 'join-the-team' => array( 'post_type' => 'post', 'post_title' => 'Join the team', 'thumbnail' => '{{image-coffee}}', 'post_content' => 'Maecenas tristique lobortis sem sit amet consectetur. Nullam pharetra ex ex, a aliquet ligula pellentesque a. Aenean et justo volutpat, malesuada purus a, sagittis eros.', ), ),
- Open the Customizer to load the starter content and click on the Publish button.
- Visit the first post titled "The new office". The single navigation indicates "Hello World" as the previous post while it should be "Join the team".
I think the bug comes from the fact that the 2 posts have the same exact date. Is there a way to specify the post date when configuring the starter content?
Attachments (1)
Change History (21)
This ticket was mentioned in Slack in #core-customize by jeffpaul. View the logs.
7 years ago
#3
@
7 years ago
- Milestone changed from Awaiting Review to 4.9.1
As I recall, a draft
or auto-draft
doesn't take kindly to having a post_date
assigned to it. I'll need to double check that. At the very least, we could make it so that each starter content post inserted gets a post_date
that decrements back 1 second for each one inserted, so that they have a stable sort according to the order they appear in the starter content config.
This ticket was mentioned in Slack in #core-customize by dlh. View the logs.
7 years ago
#6
@
7 years ago
- Keywords has-patch added; needs-patch removed
From what I've been able to tell, the auto-drafts created for starter content can have post dates assigned to them without issue. But it does look as if this fix needs to happen in three places:
- When creating the
auto-draft
inWP_Customize_Manager::import_theme_starter_content()
.
- When bumping the post date in
_wp_keep_alive_customize_changeset_dependent_auto_drafts()
.
- When publishing the starter content in
WP_Customize_Nav_Menus::save_nav_menus_created_posts()
.
42612.diff attempts to address those three changes.
There's an additional complication the patch doesn't cover: When the same starter content post is reused among themes, it's no longer safe to assume that the order of post IDs in nav_menus_created_posts
matches the order of posts as defined by the theme. The patch would need additional logic to sync the number of seconds removed from the post date to the array of starter content in the current theme.
Lastly, the patch doesn't attempt to cover sorting for attachments, although it seems to happen anyway via changes (2) and (3).
This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.
7 years ago
This ticket was mentioned in Slack in #core by desrosj. View the logs.
7 years ago
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
7 years ago
#14
@
7 years ago
Hello,
As far as I know, it still needs a feedback from the owner (or a component maintener) before landing in the next minor.
4.9.5 beta release is planned for tomorrow so we'll need a confirmation otherwise it will be punted to 4.9.6 (which is not that bad).
Cheers,
Jb
Hello @bduclos
Its because both posts are published at the same time. There is no option in starter content in which we can give post_date so there is no bug in the customize.
Thanks