diff --git a/inc/activation/namespace.php b/inc/activation/namespace.php index 1c5f61a..8bc1aaa 100644 --- a/inc/activation/namespace.php +++ b/inc/activation/namespace.php @@ -6,8 +6,28 @@ namespace Aldine\Activation; +/** + * Create default page content, importing from Pressbooks Publisher, if possible. + */ function create_default_content() { if ( ! get_option( 'pb_aldine_activated' ) ) { + $mods = get_option( 'theme_mods_pressbooks-publisher' ); + if ( $mods === false ) { + $mods = get_option( 'mods_pressbooks-publisher' ); + } + if ( $mods && isset( $mods['pressbooks_publisher_intro_textbox'] ) ) { + $home_content = apply_filters( 'the_content', $mods['pressbooks_publisher_intro_textbox'] ); + } else { + $home_content = apply_filters( + 'pb_root_home_page_content', + sprintf( + '
%2$s
', + __( 'About Pressbooks', 'pressbooks-aldine' ), + __( 'Pressbooks is easy-to-use book writing software that lets you create a book in all the formats you need to publish.', 'pressbooks-aldine' ), + __( 'Learn More', 'pressbooks-aldine' ) + ) + ); + } $default_pages = [ 'about' => [ @@ -49,14 +69,9 @@ function create_default_content() { ], 'home' => [ 'post_title' => __( 'Home', 'pressbooks-aldine' ), - 'post_content' => apply_filters( - 'pb_root_home_page_content', - sprintf( - '', - __( 'About Pressbooks', 'pressbooks-aldine' ), - __( 'Pressbooks is easy-to-use book writing software that lets you create a book in all the formats you need to publish.', 'pressbooks-aldine' ), - __( 'Learn More', 'pressbooks-aldine' ) - ) + 'post_content' => sprintf( + '