169 lines
5.9 KiB
PHP
169 lines
5.9 KiB
PHP
|
<?php
|
||
|
function duck_behavior_journal_setup()
|
||
|
{
|
||
|
add_theme_support('post-thumbnails');
|
||
|
add_theme_support('title-tag');
|
||
|
register_nav_menus(array(
|
||
|
'primary' => __('Primary Menu', 'duck-behavior-journal'),
|
||
|
'footer' => __('Footer Menu', 'duck-behavior-journal'),
|
||
|
));
|
||
|
|
||
|
add_theme_support('custom-logo');
|
||
|
|
||
|
add_theme_support('custom-header', array(
|
||
|
'default-image' => get_template_directory_uri() . '/assets/img/hero.png',
|
||
|
'width' => 1920,
|
||
|
'height' => 1080,
|
||
|
'flex-height' => true,
|
||
|
'flex-width' => true,
|
||
|
));
|
||
|
}
|
||
|
add_action('after_setup_theme', 'duck_behavior_journal_setup');
|
||
|
|
||
|
function duck_behavior_journal_scripts()
|
||
|
{
|
||
|
wp_enqueue_style('bootstrap-css', get_template_directory_uri() . '/assets/dist/css/bootstrap.min.css');
|
||
|
wp_enqueue_style('theme-style', get_stylesheet_uri());
|
||
|
wp_enqueue_script('jquery', get_template_directory_uri() . '/assets/dist/js/jquery-3.5.1.min.js', array(), null, true);
|
||
|
wp_enqueue_script('bootstrap-js', get_template_directory_uri() . '/assets/dist/js/bootstrap.min.js', array(), null, true);
|
||
|
}
|
||
|
add_action('wp_enqueue_scripts', 'duck_behavior_journal_scripts');
|
||
|
|
||
|
require_once get_template_directory() . '/class-wp-bootstrap-navwalker.php';
|
||
|
|
||
|
function duck_behavior_journal_customizer($wp_customize)
|
||
|
{
|
||
|
// Hero Image Section
|
||
|
$wp_customize->add_section('hero_image_section', array(
|
||
|
'title' => __('Hero Section', 'duck-behavior-journal'),
|
||
|
'priority' => 30,
|
||
|
));
|
||
|
|
||
|
// Hero Image Setting
|
||
|
$wp_customize->add_setting('hero_image', array(
|
||
|
'default' => get_template_directory_uri() . '/assets/hero.jpg',
|
||
|
'transport' => 'refresh',
|
||
|
));
|
||
|
|
||
|
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'hero_image_control', array(
|
||
|
'label' => __('Hero Image', 'duck-behavior-journal'),
|
||
|
'section' => 'hero_image_section',
|
||
|
'settings' => 'hero_image',
|
||
|
)));
|
||
|
|
||
|
// Hero Title Setting
|
||
|
$wp_customize->add_setting('hero_title', array(
|
||
|
'default' => 'Advancing the Understanding of Duck Behavior',
|
||
|
'transport' => 'refresh',
|
||
|
));
|
||
|
|
||
|
$wp_customize->add_control('hero_title_control', array(
|
||
|
'label' => __('Hero Title', 'duck-behavior-journal'),
|
||
|
'section' => 'hero_image_section',
|
||
|
'settings' => 'hero_title',
|
||
|
'type' => 'text',
|
||
|
));
|
||
|
|
||
|
// Hero Subtitle Setting
|
||
|
$wp_customize->add_setting('hero_subtitle', array(
|
||
|
'default' => 'Through Rigorous Scientific Research',
|
||
|
'transport' => 'refresh',
|
||
|
));
|
||
|
|
||
|
$wp_customize->add_control('hero_subtitle_control', array(
|
||
|
'label' => __('Hero Subtitle', 'duck-behavior-journal'),
|
||
|
'section' => 'hero_image_section',
|
||
|
'settings' => 'hero_subtitle',
|
||
|
'type' => 'text',
|
||
|
));
|
||
|
|
||
|
// Hero Primary Button Text Setting
|
||
|
$wp_customize->add_setting('hero_primary_button_text', array(
|
||
|
'default' => 'Submit Your Research',
|
||
|
'transport' => 'refresh',
|
||
|
));
|
||
|
|
||
|
$wp_customize->add_control('hero_primary_button_text_control', array(
|
||
|
'label' => __('Hero Primary Button Text', 'duck-behavior-journal'),
|
||
|
'section' => 'hero_image_section',
|
||
|
'settings' => 'hero_primary_button_text',
|
||
|
'type' => 'text',
|
||
|
));
|
||
|
|
||
|
// Hero Primary Button URL Setting
|
||
|
$wp_customize->add_setting('hero_primary_button_url', array(
|
||
|
'default' => '#',
|
||
|
'transport' => 'refresh',
|
||
|
));
|
||
|
|
||
|
$wp_customize->add_control('hero_primary_button_url_control', array(
|
||
|
'label' => __('Hero Primary Button URL', 'duck-behavior-journal'),
|
||
|
'section' => 'hero_image_section',
|
||
|
'settings' => 'hero_primary_button_url',
|
||
|
'type' => 'url',
|
||
|
));
|
||
|
|
||
|
// Hero Secondary Button Text Setting
|
||
|
$wp_customize->add_setting('hero_secondary_button_text', array(
|
||
|
'default' => 'Subscribe to the Journal',
|
||
|
'transport' => 'refresh',
|
||
|
));
|
||
|
|
||
|
$wp_customize->add_control('hero_secondary_button_text_control', array(
|
||
|
'label' => __('Hero Secondary Button Text', 'duck-behavior-journal'),
|
||
|
'section' => 'hero_image_section',
|
||
|
'settings' => 'hero_secondary_button_text',
|
||
|
'type' => 'text',
|
||
|
));
|
||
|
|
||
|
// Hero Secondary Button URL Setting
|
||
|
$wp_customize->add_setting('hero_secondary_button_url', array(
|
||
|
'default' => '#',
|
||
|
'transport' => 'refresh',
|
||
|
));
|
||
|
|
||
|
$wp_customize->add_control('hero_secondary_button_url_control', array(
|
||
|
'label' => __('Hero Secondary Button URL', 'duck-behavior-journal'),
|
||
|
'section' => 'hero_image_section',
|
||
|
'settings' => 'hero_secondary_button_url',
|
||
|
'type' => 'url',
|
||
|
));
|
||
|
|
||
|
// Footer Section
|
||
|
$wp_customize->add_section('footer_section', array(
|
||
|
'title' => __('Footer', 'duck-behavior-journal'),
|
||
|
'priority' => 40,
|
||
|
));
|
||
|
|
||
|
// Footer Text Setting
|
||
|
$wp_customize->add_setting('footer_text', array(
|
||
|
'default' => '© ' . date('Y') . ' Duck Behavior Journal. All rights reserved.',
|
||
|
'transport' => 'refresh',
|
||
|
));
|
||
|
|
||
|
$wp_customize->add_control('footer_text_control', array(
|
||
|
'label' => __('Footer Text', 'duck-behavior-journal'),
|
||
|
'section' => 'footer_section',
|
||
|
'settings' => 'footer_text',
|
||
|
'type' => 'textarea',
|
||
|
));
|
||
|
|
||
|
// Footer Social Media Links
|
||
|
$social_media = array('facebook', 'twitter', 'linkedin');
|
||
|
|
||
|
foreach ($social_media as $platform) {
|
||
|
$wp_customize->add_setting("footer_{$platform}_link", array(
|
||
|
'default' => '#',
|
||
|
'transport' => 'refresh',
|
||
|
));
|
||
|
|
||
|
$wp_customize->add_control("footer_{$platform}_link_control", array(
|
||
|
'label' => __(ucfirst($platform) . ' URL', 'duck-behavior-journal'),
|
||
|
'section' => 'footer_section',
|
||
|
'settings' => "footer_{$platform}_link",
|
||
|
'type' => 'url',
|
||
|
));
|
||
|
}
|
||
|
}
|
||
|
add_action('customize_register', 'duck_behavior_journal_customizer');
|