pressbooks aldine theme the theme used for the front page or default book
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

70 lines
2.7 KiB

<?php
namespace Aldine;
add_action('after_switch_theme', function () {
$default_pages = [
'about' => [
'post_title' => __('About', 'aldine'),
// @codingStandardsIgnoreStart
'post_content' => apply_filters('pb_root_about_page_content', __('Pressbooks is simple book production software. You can use Pressbooks to publish textbooks, scholarly monographs, syllabi, fiction and non-fiction books, white papers, and more in multiple formats including:
<ul><li>MOBI (for Kindle ebooks)</li>
<li>EPUB (for all other ebookstores)</li>
<li>designed PDF (for print-on-demand and digital distribution)</li></ul>
Pressbooks is used by educational institutions around the world as well as authors and publishers.
For more information about Pressbooks, see <a href="https://pressbooks.com/about">here</a>.', 'aldine'))
// @codingstandardsIgnoreEnd
],
'help' => [
'post_title' => __('Help', 'aldine'),
// @codingStandardsIgnoreStart
'post_content' => apply_filters('pb_root_help_page_content', __('The easiest way to get started with Pressbooks is to follow our <a href="https://pressbooks.com/how-to-make-a-book-with-pressbooks">4 Step Guide to Making a Book on Pressbooks</a>. Or, you can review our <a href="https://guide.pressbooks.com/">Guide to Using Pressbooks</a>.
If you require further assistance, please contact your network manager.', 'aldine'))
// @codingstandardsIgnoreEnd
],
'catalog' => [
'post_title' => __('Catalog', 'aldine'),
'post_content' => ''
],
'home' => [
'post_title' => __('Home', 'aldine'),
'post_content' => ''
],
];
if (! get_site_option('pb_aldine_activated')) {
// Add our pages
$pages = [];
foreach ($default_pages as $slug => $page) {
$check = get_page_by_path($slug);
if (empty($check)) {
$pages[$slug] = wp_insert_post(array_merge($page, ['post_type' => 'page', 'post_status' => 'publish']));
} else {
$pages[$slug] = $check->ID;
}
}
// Set front page to Home
update_option('show_on_front', 'page');
update_option('page_on_front', $pages['home']);
// Remove content generated by wp_install_defaults
if (! wp_delete_post(1, true)) {
return;
}
if (! wp_delete_post(2, true)) {
return;
}
if (! wp_delete_comment(1, true)) {
return;
}
// Add "pb_aldine_activated" site option to enable check above
add_site_option('pb_aldine_activated', true);
}
});