Add configurable Author Section to front page
This commit is contained in:
@@ -54,6 +54,33 @@ $hero_bg = get_theme_mod('hero_background_image', get_template_directory_uri() .
|
||||
</main><!-- #main -->
|
||||
</div><!-- .container -->
|
||||
|
||||
<?php if (get_theme_mod('show_author_section', false)): ?>
|
||||
<section class="author-section py-5 bg-light border-top border-bottom">
|
||||
<div class="container text-center py-4">
|
||||
<?php $author_image = get_theme_mod('author_image_url', ''); ?>
|
||||
<?php if ($author_image): ?>
|
||||
<img src="<?php echo esc_url($author_image); ?>"
|
||||
alt="<?php echo esc_attr(get_theme_mod('author_name', 'Adolfo Reyna')); ?>"
|
||||
class="rounded-circle mb-4 shadow-sm"
|
||||
style="width: 150px; height: 150px; object-fit: cover; border: 4px solid white;">
|
||||
<?php else: ?>
|
||||
<div class="rounded-circle mb-4 shadow-sm mx-auto bg-secondary d-flex align-items-center justify-content-center text-white display-4"
|
||||
style="width: 150px; height: 150px; border: 4px solid white;">
|
||||
<?php
|
||||
$name = get_theme_mod('author_name', 'Adolfo Reyna');
|
||||
echo esc_html(substr($name, 0, 1));
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<h2 class="display-6 fw-bold font-serif mb-3 text-dark">
|
||||
<?php echo esc_html(get_theme_mod('author_name', 'Adolfo Reyna')); ?></h2>
|
||||
<p class="lead font-sans text-muted mx-auto" style="max-width: 680px;">
|
||||
<?php echo wp_kses_post(get_theme_mod('author_bio', 'Exploring the intersection of faith, leadership, and modern life. Join me on a journey to uncover timeless wisdom.')); ?>
|
||||
</p>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php get_template_part('template-parts/newsletter'); ?>
|
||||
|
||||
<?php
|
||||
|
||||
@@ -115,6 +115,55 @@ function wisdom1_customize_register($wp_customize)
|
||||
'settings' => 'hero_background_image',
|
||||
)));
|
||||
|
||||
// Add Author Section (Front Page)
|
||||
$wp_customize->add_section('wisdom1_author_section', array(
|
||||
'title' => __('Author Section (Front Page)', 'wisdom1'),
|
||||
'priority' => 32,
|
||||
));
|
||||
|
||||
// Enable Author Section
|
||||
$wp_customize->add_setting('show_author_section', array(
|
||||
'default' => false,
|
||||
'sanitize_callback' => 'rest_sanitize_boolean',
|
||||
));
|
||||
$wp_customize->add_control('show_author_section', array(
|
||||
'label' => __('Show Author Section', 'wisdom1'),
|
||||
'section' => 'wisdom1_author_section',
|
||||
'type' => 'checkbox',
|
||||
));
|
||||
|
||||
// Author Name
|
||||
$wp_customize->add_setting('author_name', array(
|
||||
'default' => 'Adolfo Reyna',
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
));
|
||||
$wp_customize->add_control('author_name', array(
|
||||
'label' => __('Author Name', 'wisdom1'),
|
||||
'section' => 'wisdom1_author_section',
|
||||
'type' => 'text',
|
||||
));
|
||||
|
||||
// Author Bio
|
||||
$wp_customize->add_setting('author_bio', array(
|
||||
'default' => 'Exploring the intersection of faith, leadership, and modern life. Join me on a journey to uncover timeless wisdom.',
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
));
|
||||
$wp_customize->add_control('author_bio', array(
|
||||
'label' => __('Author Bio', 'wisdom1'),
|
||||
'section' => 'wisdom1_author_section',
|
||||
'type' => 'textarea',
|
||||
));
|
||||
|
||||
// Author Image
|
||||
$wp_customize->add_setting('author_image_url', array(
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
));
|
||||
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'author_image_url', array(
|
||||
'label' => __('Author Image', 'wisdom1'),
|
||||
'section' => 'wisdom1_author_section',
|
||||
)));
|
||||
|
||||
// Add Newsletter Section
|
||||
$wp_customize->add_section('wisdom1_newsletter_section', array(
|
||||
'title' => __('Newsletter Section', 'wisdom1'),
|
||||
|
||||
Reference in New Issue
Block a user