Opened 8 years ago
Last modified 4 years ago
#38624 new enhancement
Allow starter content to apply after a site has already been set up and is no longer “fresh”
Reported by: | westonruter | Owned by: | |
---|---|---|---|
Milestone: | Future Release | Priority: | normal |
Severity: | normal | Version: | |
Component: | Customize | Keywords: | |
Focuses: | Cc: |
Description
Starter content for themes was introduced in #38114. In order to prevent the starter content from overriding a site's existing content, a fresh_site
option flag was added to prevent the content from applying after the site has been first updated. This means the starter content has limited use when installing new themes to try out during the life of a site.
The primary problem for applying starter content on an existing site is how to handle the merge conflicts, how to decide when to use the starter content/configs and when to use existing site content/configs. One option would be a button to “reset” a site to use the starter content. For more granularity, once the starter content is applied there could be a list of the settings that were modified so that you could then go through and evaluate each change to see if you want to keep it. Each control that has a setting containing dirty starter content could be highlighted in some way with a button that allows you to revert the starter content or toggle the starter content so you can compare before/after.
This is closely related to #21666 (Customizer reset/undo/revert) and #31089 (Add revisions of settings to the Customizer).
Attachments (2)
Change History (30)
This ticket was mentioned in Slack in #themereview by rabmalin. View the logs.
8 years ago
#4
@
8 years ago
Hi,
Just adding additional info about the current implementation issue here:
With current checking for `fresh_site` it is actually not possible to use a theme starter content with WordPress network (multisite) setup either. As fresh_site
is actually set during the WordPress installation only and is nulled after publishing a post/page or saving a widget or customizer settings, which could already be triggered on one of sites in the network installation.
Please keep this in mind too. Would be great if the feature works with WordPress network.
Thanks and regards,
Oliver
This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.
8 years ago
This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.
8 years ago
This ticket was mentioned in Slack in #themereview by suganya. View the logs.
7 years ago
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
7 years ago
This ticket was mentioned in Slack in #core by jeffpaul. View the logs.
7 years ago
#12
@
7 years ago
@joshuawold I reworked the feature plugin I initially put together for prototyping starter content to now be a plugin for adding a UI for applying starter content to non-fresh sites: https://github.com/xwp/wp-trac-38624
Initial rudimentary UI can be seen in load-starter-content-button.png.
This ticket was mentioned in Slack in #core-customize by westonruter. View the logs.
7 years ago
#15
@
7 years ago
Hi @westonruter,
Is there any future idea to add post category in starter content. now post possible arguments are
'post_type',
'post_title',
'post_excerpt',
'post_name',
'post_content',
'menu_order',
'comment_status',
'thumbnail',
'template',
#16
@
7 years ago
@suganya1993 that's a good suggestion, but without #38227 it would be required to actually insert live terms into the database even prior to publishing.
#18
@
7 years ago
@joshuawold I reworked the feature plugin
- Is this testable now?
- Is the above sketch still relevant to the discussion (pulling from our chat into this ticket)?
#19
@
7 years ago
@JoshuaWold the feature plugin merely adds the Load Starter Content button, which then just ignores whether or not it is a fresh_site
when applying the starter content. Your sketch is definitely still relevant, as the feature plugin implements no UI other than that one button. The button needs to be augmented/replaced with fine-grained control over which starter content bits gets applied.
#21
@
7 years ago
One workaround we're taking for a spin on a multi-site network is to check for fresh_site
with a default value of NULL
and then queuing an action to call WP_Customize_Manager->import_theme_starter_content()
if the option value is NULL
or 1
.
For example:
<?php // In functions.php... add_action('after_setup_theme', 'sometheme_setup'); function sometheme_setup () { add_theme_support('starter-content', array(/* ... */)); // Manually run starter content // Related: https://core.trac.wordpress.org/ticket/38624 global $pagenow; $fresh_site = get_option('fresh_site', NULL); if ((is_null($fresh_site) || $fresh_site == 1) && $pagenow === 'customize.php') { global $wp_customize; add_action('after_setup_theme', array($wp_customize, 'import_theme_starter_content'), 100); } } // End sometheme_setup()
From what I can tell the issue seems to be that fresh_site
isn't set for sub-sites initially and so returns false when checked in WP_Customize_Manager
(line 551).
By setting the default value of get_option()
to NULL
and getting the fresh_site
option we can distinguish between the false-y 0
value set in default-filters.php (line 197) or a non-existent value.
This has allowed us to have starter content in sub-sites without issue.
(Perhaps this information should go into another ticket as it doesn't quite belong here aside from the mention about multi-site support above by @webmandesign.)
I want there to be a feature plugin soon that provides a UI, a button, for applying starter content to your already-established site. I also want there to be a UI for being able to select from among multiple sets of starter content.