Continues the Bookshelf history. The three plugins tracked there are consolidated into umbra-bookshelf/ and this repository becomes the canonical home for the plugin and the theme. bd-bookshelf/ -> theme/ separate artifact, name unchanged (root specs) -> umbra-bookshelf/spec/ aligned to Umbra Bookshelf old plugin zips -> archive/pre-umbra-releases/ Adds a repository README and drops the Bookshelf closure notice.
289 lines
9.4 KiB
PHP
289 lines
9.4 KiB
PHP
<?php
|
|
// Copyright 2026 Umbra Tools (umbratools.com)
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
/**
|
|
* Customizer Settings
|
|
*
|
|
* @package BD_Murphy
|
|
*/
|
|
|
|
if (!defined('ABSPATH')) {
|
|
exit;
|
|
}
|
|
|
|
/**
|
|
* Add Customizer settings
|
|
*
|
|
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
|
|
*/
|
|
function bdm_customize_register($wp_customize) {
|
|
|
|
// Colors Panel
|
|
$wp_customize->add_panel('bdm_colors', array(
|
|
'title' => esc_html__('Colors', 'bd-bookshelf'),
|
|
'priority' => 30,
|
|
));
|
|
|
|
$wp_customize->add_section('bdm_primary_colors', array(
|
|
'title' => esc_html__('Primary Colors', 'bd-bookshelf'),
|
|
'panel' => 'bdm_colors',
|
|
));
|
|
|
|
// Primary Color
|
|
$wp_customize->add_setting('primary_color', array(
|
|
'default' => '#1B3A6B',
|
|
'sanitize_callback' => 'sanitize_hex_color',
|
|
'transport' => 'refresh',
|
|
));
|
|
|
|
$wp_customize->add_control(new WP_Customize_Color_Control(
|
|
$wp_customize,
|
|
'primary_color',
|
|
array(
|
|
'label' => esc_html__('Primary Color (Navy)', 'bd-bookshelf'),
|
|
'section' => 'bdm_primary_colors',
|
|
)
|
|
));
|
|
|
|
// Accent Color
|
|
$wp_customize->add_setting('accent_color', array(
|
|
'default' => '#C8A96E',
|
|
'sanitize_callback' => 'sanitize_hex_color',
|
|
'transport' => 'refresh',
|
|
));
|
|
|
|
$wp_customize->add_control(new WP_Customize_Color_Control(
|
|
$wp_customize,
|
|
'accent_color',
|
|
array(
|
|
'label' => esc_html__('Accent Color (Gold)', 'bd-bookshelf'),
|
|
'section' => 'bdm_primary_colors',
|
|
)
|
|
));
|
|
|
|
// Typography Panel
|
|
$wp_customize->add_panel('bdm_typography', array(
|
|
'title' => esc_html__('Typography', 'bd-bookshelf'),
|
|
'priority' => 35,
|
|
));
|
|
|
|
// Heading Fonts Section
|
|
$wp_customize->add_section('bdm_heading_fonts', array(
|
|
'title' => esc_html__('Headings', 'bd-bookshelf'),
|
|
'panel' => 'bdm_typography',
|
|
));
|
|
|
|
$heading_fonts = array(
|
|
'Playfair Display' => 'Playfair Display',
|
|
'Merriweather' => 'Merriweather',
|
|
'Libre Baskerville'=> 'Libre Baskerville',
|
|
'Lora' => 'Lora',
|
|
'Georgia' => 'Georgia',
|
|
);
|
|
|
|
$wp_customize->add_setting('heading_font', array(
|
|
'default' => 'Playfair Display',
|
|
'sanitize_callback' => 'sanitize_text_field',
|
|
'transport' => 'refresh',
|
|
));
|
|
|
|
$wp_customize->add_control('heading_font', array(
|
|
'label' => esc_html__('Heading Font', 'bd-bookshelf'),
|
|
'section' => 'bdm_heading_fonts',
|
|
'type' => 'select',
|
|
'choices' => $heading_fonts,
|
|
));
|
|
|
|
// Body Fonts Section
|
|
$wp_customize->add_section('bdm_body_fonts', array(
|
|
'title' => esc_html__('Body', 'bd-bookshelf'),
|
|
'panel' => 'bdm_typography',
|
|
));
|
|
|
|
$body_fonts = array(
|
|
'Lato' => 'Lato',
|
|
'Open Sans' => 'Open Sans',
|
|
'Source Sans Pro'=> 'Source Sans Pro',
|
|
'Roboto' => 'Roboto',
|
|
'Calibri' => 'Calibri',
|
|
);
|
|
|
|
$wp_customize->add_setting('body_font', array(
|
|
'default' => 'Lato',
|
|
'sanitize_callback' => 'sanitize_text_field',
|
|
'transport' => 'refresh',
|
|
));
|
|
|
|
$wp_customize->add_control('body_font', array(
|
|
'label' => esc_html__('Body Font', 'bd-bookshelf'),
|
|
'section' => 'bdm_body_fonts',
|
|
'type' => 'select',
|
|
'choices' => $body_fonts,
|
|
));
|
|
|
|
// Social Sharing Section
|
|
$wp_customize->add_section('bdm_social_sharing', array(
|
|
'title' => esc_html__('Social Sharing', 'bd-bookshelf'),
|
|
'priority' => 60,
|
|
));
|
|
|
|
// Facebook
|
|
$wp_customize->add_setting('share_facebook', array(
|
|
'default' => true,
|
|
'sanitize_callback' => 'wp_validate_boolean',
|
|
));
|
|
|
|
$wp_customize->add_control('share_facebook', array(
|
|
'label' => esc_html__('Show Facebook', 'bd-bookshelf'),
|
|
'section' => 'bdm_social_sharing',
|
|
'type' => 'checkbox',
|
|
));
|
|
|
|
// X/Twitter
|
|
$wp_customize->add_setting('share_twitter', array(
|
|
'default' => true,
|
|
'sanitize_callback' => 'wp_validate_boolean',
|
|
));
|
|
|
|
$wp_customize->add_control('share_twitter', array(
|
|
'label' => esc_html__('Show X/Twitter', 'bd-bookshelf'),
|
|
'section' => 'bdm_social_sharing',
|
|
'type' => 'checkbox',
|
|
));
|
|
|
|
// LinkedIn
|
|
$wp_customize->add_setting('share_linkedin', array(
|
|
'default' => true,
|
|
'sanitize_callback' => 'wp_validate_boolean',
|
|
));
|
|
|
|
$wp_customize->add_control('share_linkedin', array(
|
|
'label' => esc_html__('Show LinkedIn', 'bd-bookshelf'),
|
|
'section' => 'bdm_social_sharing',
|
|
'type' => 'checkbox',
|
|
));
|
|
|
|
// WhatsApp
|
|
$wp_customize->add_setting('share_whatsapp', array(
|
|
'default' => true,
|
|
'sanitize_callback' => 'wp_validate_boolean',
|
|
));
|
|
|
|
$wp_customize->add_control('share_whatsapp', array(
|
|
'label' => esc_html__('Show WhatsApp', 'bd-bookshelf'),
|
|
'section' => 'bdm_social_sharing',
|
|
'type' => 'checkbox',
|
|
));
|
|
|
|
// Author Book Settings Section
|
|
$wp_customize->add_section('bdm_book_settings', array(
|
|
'title' => esc_html__('Author Book Settings', 'bd-bookshelf'),
|
|
'priority' => 50,
|
|
));
|
|
|
|
// Author Name
|
|
$wp_customize->add_setting('author_name', array(
|
|
'default' => 'B.D. Murphy',
|
|
'sanitize_callback' => 'sanitize_text_field',
|
|
'transport' => 'refresh',
|
|
));
|
|
|
|
$wp_customize->add_control('author_name', array(
|
|
'label' => esc_html__('Author Name', 'bd-bookshelf'),
|
|
'description' => esc_html__('Your author/pen name to display in widgets', 'bd-bookshelf'),
|
|
'section' => 'bdm_book_settings',
|
|
'type' => 'text',
|
|
));
|
|
|
|
// Goodreads Author ID
|
|
$wp_customize->add_setting('goodreads_author_id', array(
|
|
'default' => '30469651',
|
|
'sanitize_callback' => 'sanitize_text_field',
|
|
'transport' => 'refresh',
|
|
));
|
|
|
|
$wp_customize->add_control('goodreads_author_id', array(
|
|
'label' => esc_html__('Goodreads Author ID', 'bd-bookshelf'),
|
|
'description' => esc_html__('Your Goodreads author page ID. Default: 30469651 (B.D. Murphy)', 'bd-bookshelf'),
|
|
'section' => 'bdm_book_settings',
|
|
'type' => 'text',
|
|
));
|
|
|
|
// Amazon Author Central ID
|
|
$wp_customize->add_setting('amazon_author_id', array(
|
|
'default' => '30469651',
|
|
'sanitize_callback' => 'sanitize_text_field',
|
|
'transport' => 'refresh',
|
|
));
|
|
|
|
$wp_customize->add_control('amazon_author_id', array(
|
|
'label' => esc_html__('Amazon Author Central Author ID', 'bd-bookshelf'),
|
|
'description' => esc_html__('Enter your Amazon Author Central author page ID', 'bd-bookshelf'),
|
|
'section' => 'bdm_book_settings',
|
|
'type' => 'text',
|
|
));
|
|
|
|
|
|
// ============================================
|
|
// Display Options Section
|
|
// ============================================
|
|
$wp_customize->add_section('bdm_display_options', array(
|
|
'title' => esc_html__('Display Options', 'bd-bookshelf'),
|
|
'priority' => 55,
|
|
));
|
|
|
|
// Show Newsletter Signup
|
|
$wp_customize->add_setting('show_newsletter_signup', array(
|
|
'default' => true,
|
|
'sanitize_callback' => 'wp_validate_boolean',
|
|
'transport' => 'refresh',
|
|
));
|
|
|
|
$wp_customize->add_control('show_newsletter_signup', array(
|
|
'label' => esc_html__('Show Newsletter Signup Section', 'bd-bookshelf'),
|
|
'description' => esc_html__('Display the newsletter signup box on the About page sidebar', 'bd-bookshelf'),
|
|
'section' => 'bdm_display_options',
|
|
'type' => 'checkbox',
|
|
));
|
|
|
|
// Show Sign Up for Updates Link
|
|
$wp_customize->add_setting('show_signup_link', array(
|
|
'default' => true,
|
|
'sanitize_callback' => 'wp_validate_boolean',
|
|
'transport' => 'refresh',
|
|
));
|
|
|
|
$wp_customize->add_control('show_signup_link', array(
|
|
'label' => esc_html__('Show "Sign Up for Updates" Link', 'bd-bookshelf'),
|
|
'description' => esc_html__('Display the sign-up link in the About page and footer', 'bd-bookshelf'),
|
|
'section' => 'bdm_display_options',
|
|
'type' => 'checkbox',
|
|
));
|
|
|
|
// Enable Goodreads Remote Fetching
|
|
$wp_customize->add_setting('enable_goodreads_fetch', array(
|
|
'default' => false,
|
|
'sanitize_callback' => 'wp_validate_boolean',
|
|
'transport' => 'refresh',
|
|
));
|
|
|
|
$wp_customize->add_control('enable_goodreads_fetch', array(
|
|
'label' => esc_html__('Enable Goodreads Integration', 'bd-bookshelf'),
|
|
'description' => esc_html__('Allow the theme to fetch book data from Goodreads. This sends data to a third-party service. Disable if you prefer not to share data with Goodreads.', 'bd-bookshelf'),
|
|
'section' => 'bdm_display_options',
|
|
'type' => 'checkbox',
|
|
));
|
|
}
|
|
add_action('customize_register', 'bdm_customize_register');
|
|
|
|
/**
|
|
* Sanitize checkbox
|
|
*
|
|
* @param mixed $checked Checked value.
|
|
* @return bool
|
|
*/
|
|
function bdm_sanitize_checkbox($checked) {
|
|
return ((isset($checked) && true === $checked) ? true : false);
|
|
}
|