= 2 || $page >= 2 )
$title = "$title $sep " . sprintf( __( 'Page %s', 'BonAppetit' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'wpdocs_filter_wp_title', 10, 2 );
/**
* Add support for comment reply.
*/
function bonappetit_enqueue_comments_reply() {
if( get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
if ( ! function_exists( 'bonappetit_setup' ) ) {
function bonappetit_setup() {
/**
* Make the theme available for translation.
*/
$lang_dir = get_stylesheet_directory_uri() . '/languages';
load_theme_textdomain( 'BonAppetit', $lang_dir );
/**
* Add support for title tag.
*/
add_theme_support( "title-tag" );
/**
* Add support for post formats.
*/
add_theme_support( 'post-formats',
array(
'gallery',
'link',
'image',
'quote',
'video',
'audio'
)
);
/**
* Add support for automatic feed links.
*/
add_theme_support( 'automatic-feed-links' );
/**
* Add support for post thumbnails.
*/
add_theme_support( 'post-thumbnails' );
/**
* Add support for custom background
*/
$args = array(
'default-color' => '000000',
'default-image' => get_template_directory_uri() . '/images/background.jpg',
);
add_theme_support( 'custom-background', $args );
/**
* Add support for custom header image
*/
$args = array(
'flex-width' => true,
'width' => 1000,
'flex-height' => true,
'height' => 300,
'default-image' => get_template_directory_uri() . '/images/header.jpg',
);
add_theme_support( 'custom-header', $args );
/**
* Register nav menus.
*/
register_nav_menus(
array(
'primary' => __( 'Primary Navigation', 'BonAppetit' ),
'secondary' => __( 'Secondary Menu', 'BonAppetit'),
)
);
}
add_action( 'after_setup_theme', 'bonappetit_setup' );
}
// Register Custom Navigation Walker
require_once('wp_bootstrap_navwalker.php');
/**
* ----------------------------------------------------------------------------------------
* 5.0 - Display meta information for a specific post
* ----------------------------------------------------------------------------------------
*/
if (! function_exists('bonappetit_post_meta')) {
function bonappetit_post_meta() {
echo '
';
if (get_post_type() === 'post') {
// sticky //
if (is_sticky()){
echo '- '. __('Sticky', 'BonAppetit') .'
';
}
// Author //
printf(
'- %2$s
',
esc_url(get_author_posts_url(get_the_author_meta('ID' ) ) ),
get_the_author()
);
// Date //
echo '- ' . get_the_date() . '
';
// Category //
$category_list = get_the_category_list(', ' );
if( $category_list) {
echo '- ' . $category_list . '
';
}
// Category //
$tag_list = get_the_tag_list('',', ' );
if( $tag_list) {
echo '- ' . $tag_list . '
';
}
// Comments //
if (comments_open( )):
echo '- ';
echo '';
comments_popup_link ( __('Leave a comment', 'BonAppetit'), __('One comment so far', 'BonAppetit'), __('View all % comments', 'BonAppetit'));
echo '';
echo '
';
endif;
// Edit //
if (is_user_logged_in()) {
echo '- ';
edit_post_link( __( 'Edit', 'BonAppetit' ), '', '' );
echo '
';
}
}
}
}
/**
* ----------------------------------------------------------------------------------------
* 6.0 - Display navigation to the next/previous set of posts.
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists('bonappetit_paging_nav')) {
function bonappetit_paging_nav() { ?>
-
Newer Posts', 'BonAppetit'))?>
-
', 'BonAppetit'))?>
__( 'Main Widget Area', 'BonAppetit'),
'id' => 'sidebar-1',
'description' => __('Appears on posts and pages.', 'BonAppetit'),
'before_widget'=> '',
'after_widget'=> '
',
'before_title'=> '',
)
);
register_sidebar(
array(
'name' => __( 'Footer Widget Area', 'BonAppetit'),
'id' => 'sidebar-2',
'description' => __('Appears in footer.', 'BonAppetit'),
'before_widget'=> '',
'after_widget'=> '
',
'before_title'=> '',
)
);
}
}
add_action('widgets_init', 'bonappetit_widget_init' );
}
/* ------------------------------------------------ */
/* 8.0 - SCRIPTS */
/* ------------------------------------------------ */
if ( ! function_exists( 'bonappetit_scripts' ) ) {
function bonappetit_scripts() {
/* Register scripts. */
wp_register_script('flexslider-js', get_stylesheet_directory_uri() . '/js/jquery.flexslider.min.js', array('jquery'), '2.6', true );
wp_register_script( 'bootstrap-js', get_stylesheet_directory_uri() . '/bootstrap/js/bootstrap.min.js', array( 'jquery' ), false, true );
wp_register_script('main-js', get_stylesheet_directory_uri() . '/js/scripts.js', false, false, true );
/* Load the custom scripts. */
wp_enqueue_script('flexslider-js');
wp_enqueue_script( 'bootstrap-js' );
wp_enqueue_script( 'main-js' );
/* Load the stylesheets. */
wp_enqueue_style( 'bootstrap-css', get_stylesheet_directory_uri() . '/bootstrap/css/bootstrap.min.css' );
wp_enqueue_style( 'fontawesome-css', get_stylesheet_directory_uri() . '/font-awesome/css/font-awesome.min.css' );
wp_enqueue_style( 'flexslider-css', get_stylesheet_directory_uri() . '/css/flexslider.css' );
wp_enqueue_style( 'main-css', get_stylesheet_directory_uri() . '/style.css' );
}
add_action( 'wp_enqueue_scripts', 'bonappetit_scripts' );
}
/* ------------------------------------------------ */
/* 9.0 - CUSTOMIZER */
/* ------------------------------------------------ */
if ( ! function_exists( 'bonappetit_customize_register' ) ) {
function bonappetit_customize_register( $wp_customize ) {
/********************
Define generic controls
*********************/
// create class to define textarea controls in Customizer
class bonappetit_customize_textarea_control extends wp_customize_control {
public $type = 'textarea';
public function render_content() {
echo '';
}
}
/********************
General Options
*********************/
$wp_customize->add_panel( 'ba_details', array(
'priority' => 1,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __('General Options', 'BonAppetit'),
) );
$wp_customize->add_section( 'bonappetit_description' , array(
'title' => __( 'Blog Description & Logo', 'BonAppetit'),
'priority' => 2,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'panel' => 'ba_details',
) );
// Static Front Page
$site_title = $wp_customize->get_section( 'static_front_page' );
$site_title->panel = 'ba_details';
// Change panel for Background Image
$site_title = $wp_customize->get_section( 'background_image' );
$site_title->panel = 'ba_details';
// Colors
$site_title = $wp_customize->get_section( 'colors' );
$site_title->panel = 'ba_details';
$site_title->title = __('Background Colors', 'BonAppetit');
// Header Image
$site_title = $wp_customize->get_section( 'header_image' );
$site_title->panel = 'ba_details';
// Header Image
$site_title = $wp_customize->get_section( 'title_tagline' );
$site_title->panel = 'ba_details';
$site_title->priority = 1;
// Custom Colours
$wp_customize->add_section( 'bonappetit_colors' , array(
'title' => __( 'Text Elements Color Scheme', 'BonAppetit'),
'priority' => 3,
'panel' => 'ba_details',
));
//main - title, h1, h2, h4, nav links, footer headings, widget headings
$textcolors [] = array(
'slug' => 'bonappetit_color1',
'default' => '#005772',
'sanitize_callback' => 'sanitize_hex_color',
'label' => __('Main color', 'BonAppetit')
);
//secondary - site description, sidebar headings, h3, h5, nav links on hover
$textcolors [] = array(
'slug' => 'bonappetit_color2',
'default' => '#003687',
'label' => __('Secondary color', 'BonAppetit'),
'sanitize_callback' => 'sanitize_hex_color'
);
// Link
$textcolors [] = array(
'slug' => 'bonappetit_links_color1',
'default' => '#ed003f',
'label' => __('Links color', 'BonAppetit'),
'sanitize_callback' => 'sanitize_hex_color'
);
// Link hover
$textcolors [] = array(
'slug' => 'bonappetit_links_color2',
'default' => '#eded93',
'label' => __('Links color (on hover)', 'BonAppetit'),
'sanitize_callback' => 'sanitize_hex_color'
);
// add settings
foreach ($textcolors as $textcolor) {
// add_setting
$wp_customize -> add_setting(
$textcolor ['slug'], array(
'default' => $textcolor['default'],
'type' => 'option',
'sanitize_callback' => 'sanitize_hex_color',
'transport'=>'postMessage'
)
);
// Color control
$wp_customize -> add_control (new wp_customize_color_control(
$wp_customize,
$textcolor['slug'],
array(
'label'=> $textcolor['label'],
'section'=> 'bonappetit_colors',
'settings'=> $textcolor['slug'],
'sanitize_callback' => 'sanitize_hex_color',
)
));
}
// Logo
$wp_customize->add_setting( 'bonappetit_logo_upload', array(
'default' => get_stylesheet_directory_uri() . '/images/logo.png',
'sanitize_callback' => 'esc_url_raw',
'transport'=>'postMessage'
) );
$wp_customize-> add_control(new wp_customize_image_control(
$wp_customize,
'bonappetit_logo_upload',
array(
'label' => __('Upload your logo', 'BonAppetit'),
'section' => 'bonappetit_description',
'settings'=> 'bonappetit_logo_upload',
)
));
//Description
$wp_customize->add_setting( 'bonappetit_description_setting', array (
'default' => __( 'Your description', 'BonAppetit' ),
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control( new bonappetit_Customize_Textarea_Control(
$wp_customize,
'bonappetit_description_setting',
array(
'label' => __( 'Short Description of your Blog', 'BonAppetit' ),
'section' => 'bonappetit_description',
'settings' => 'bonappetit_description_setting',
'sanitize_callback' => 'esc_textarea',
)));
//*********//
//Frontpage//
//*********//
$wp_customize->add_panel( 'ba_frontpage', array(
'priority' => 2,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __('Custom Frontpage', 'BonAppetit'),
) );
$wp_customize->add_section( 'bonappetit_front' , array(
'title' => __( 'Custom Text Elements', 'BonAppetit'),
'priority' => 1,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'description' => __('Frontpage text elements configuration', 'BonAppetit'),
'panel' => 'ba_frontpage',
) );
//Frontpage Text
//Frontpage Paragrapht
$wp_customize->add_setting( 'bonappetit_fronttitle_setting', array (
'default' => __( 'Your Text', 'BonAppetit' ),
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control( new bonappetit_Customize_Textarea_Control(
$wp_customize,
'bonappetit_fronttitle_setting',
array(
'label' => __( 'Your Title', 'BonAppetit' ),
'section' => 'bonappetit_front',
'settings' => 'bonappetit_fronttitle_setting',
'sanitize_callback' => 'esc_textarea'
)));
//Frontpage Paragrapht
$wp_customize->add_setting( 'bonappetit_frontparagraph_setting', array (
'default' => __( 'Your Text', 'BonAppetit' ),
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control( new bonappetit_Customize_Textarea_Control(
$wp_customize,
'bonappetit_frontparagraph_setting',
array(
'label' => __( 'Short Paragraph', 'BonAppetit' ),
'section' => 'bonappetit_front',
'settings' => 'bonappetit_frontparagraph_setting',
'sanitize_callback' => 'esc_textarea'
)));
// Testimonials
$wp_customize->add_section( 'bonappetit_testimonials' , array(
'title' => __( 'Client Testimonials', 'BonAppetit'),
'priority' => 2,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'description' => __('Frontpage Client Testimonial configuration', 'BonAppetit'),
'panel' => 'ba_frontpage',
) );
//Settings
//Testimonial 1
// Text
$wp_customize->add_setting( 'bonappetit_testimonialone_setting', array (
'default' => __( 'Client Testimonial #1', 'BonAppetit' ),
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control( new bonappetit_Customize_Textarea_Control(
$wp_customize,
'bonappetit_testimonialone_setting',
array(
'label' => __( 'Testimonial', 'BonAppetit' ),
'section' => 'bonappetit_testimonials',
'settings' => 'bonappetit_testimonialone_setting',
'sanitize_callback' => 'esc_textarea'
)));
// Author
$wp_customize->add_setting( 'bonappetit_testimonialonea_setting', array (
'default' => __( '- Client One', 'BonAppetit' ),
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control( new bonappetit_Customize_Textarea_Control(
$wp_customize,
'bonappetit_testimonialonea_setting',
array(
'label' => __( 'Client ', 'BonAppetit' ),
'section' => 'bonappetit_testimonials',
'settings' => 'bonappetit_testimonialonea_setting',
'sanitize_callback' => 'esc_textarea'
)));
//Testimonial 2
// Text
$wp_customize->add_setting( 'bonappetit_testimonialtwo_setting', array (
'default' => __( 'Client Testimonial #2', 'BonAppetit' ),
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control( new bonappetit_Customize_Textarea_Control(
$wp_customize,
'bonappetit_testimonialtwo_setting',
array(
'label' => __( 'Testimonial #2', 'BonAppetit' ),
'section' => 'bonappetit_testimonials',
'settings' => 'bonappetit_testimonialtwo_setting',
'sanitize_callback' => 'esc_textarea'
)));
// Author
$wp_customize->add_setting( 'bonappetit_testimonialtwoa_setting', array (
'default' => __( '- Client Two', 'BonAppetit' ),
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control( new bonappetit_Customize_Textarea_Control(
$wp_customize,
'bonappetit_testimonialtwoa_setting',
array(
'label' => __( 'Client ', 'BonAppetit' ),
'section' => 'bonappetit_testimonials',
'settings' => 'bonappetit_testimonialtwoa_setting',
'sanitize_callback' => 'esc_textarea'
)));
//Testimonial 3
// Text
$wp_customize->add_setting( 'bonappetit_testimonialthree_setting', array (
'default' => __( 'Client Testimonial #3', 'BonAppetit' ),
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control( new bonappetit_Customize_Textarea_Control(
$wp_customize,
'bonappetit_testimonialthree_setting',
array(
'label' => __( 'Testimonial #3', 'BonAppetit' ),
'section' => 'bonappetit_testimonials',
'settings' => 'bonappetit_testimonialthree_setting',
'sanitize_callback' => 'esc_textarea',
)));
// Author
$wp_customize->add_setting( 'bonappetit_testimonialthreea_setting', array (
'default' => __( '- Client Three', 'BonAppetit' ),
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control( new bonappetit_Customize_Textarea_Control(
$wp_customize,
'bonappetit_testimonialthreea_setting',
array(
'label' => __( 'Client ', 'BonAppetit' ),
'section' => 'bonappetit_testimonials',
'settings' => 'bonappetit_testimonialthreea_setting',
'sanitize_callback' => 'esc_textarea',
)));
//Social Icons
$wp_customize->add_section( 'bonappetit_socialicons' , array(
'title' => __( 'Social Networks', 'BonAppetit'),
'priority' => 6,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'description' => __('Social Icon Configuration', 'BonAppetit'),
'panel' => 'ba_frontpage',
) );
// Settings
// Facebook
$wp_customize->add_setting( 'bonappetit_facebook', array (
'sanitize_callback' => 'esc_url_raw',
'default' => esc_url( 'www.facebook.com' ),
'transport' => 'postMessage'
) );
$wp_customize->add_control( 'bonappetit_facebook',
array(
'label' => esc_html__( 'Facebook Icon', 'BonAppetit' ),
'description' => esc_html__( 'Add your Facebook URL', 'BonAppetit' ),
'section' => 'bonappetit_socialicons',
'settings' => 'bonappetit_facebook',
)
);
$wp_customize->add_setting( 'bonappetit_facebookdisplay', array (
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control(
'bonappetit_facebookdisplay',
array(
'section' => 'bonappetit_socialicons',
'label' => 'Display Social Network',
'type' => 'checkbox',
'default' => false,
)
);
// TripAdvisor
$wp_customize->add_setting( 'bonappetit_tripadvisor', array (
'sanitize_callback' => 'esc_url_raw',
'default' => esc_url( 'www.tripadvisor.com' ),
'transport' => 'postMessage'
) );
$wp_customize->add_control( 'bonappetit_tripadvisor',
array(
'label' => esc_html__( 'TripAdvisor Icon', 'BonAppetit' ),
'description' => esc_html__( 'Add your TripAdvisor URL', 'BonAppetit' ),
'section' => 'bonappetit_socialicons',
'settings' => 'bonappetit_tripadvisor',
)
);
$wp_customize->add_setting( 'bonappetit_tripadvisordisplay', array (
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control(
'bonappetit_tripadvisordisplay',
array(
'section' => 'bonappetit_socialicons',
'label' => 'Display Social Network',
'type' => 'checkbox',
'default' => false,
)
);
// Twitter
$wp_customize->add_setting( 'bonappetit_twitter', array (
'sanitize_callback' => 'esc_url_raw',
'default' => esc_url( 'www.twitter.com' ),
'transport' => 'postMessage'
) );
$wp_customize->add_control( 'bonappetit_twitter',
array(
'label' => esc_html__( 'Twitter Icon', 'BonAppetit' ),
'description' => esc_html__( 'Add your Twitter URL', 'BonAppetit' ),
'section' => 'bonappetit_socialicons',
'settings' => 'bonappetit_twitter',
)
);
$wp_customize->add_setting( 'bonappetit_twitterdisplay', array (
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control(
'bonappetit_twitterdisplay',
array(
'section' => 'bonappetit_socialicons',
'label' => 'Display Social Network',
'type' => 'checkbox',
'default' => false,
)
);
// Google
$wp_customize->add_setting( 'bonappetit_google', array (
'sanitize_callback' => 'esc_url_raw',
'default' => esc_url( 'www.plus.google.com' ),
'transport' => 'postMessage'
) );
$wp_customize->add_control( 'bonappetit_google',
array(
'label' => esc_html__( 'Google Icon', 'BonAppetit' ),
'description' => esc_html__( 'Add your Google + URL', 'BonAppetit' ),
'section' => 'bonappetit_socialicons',
'settings' => 'bonappetit_google',
)
);
$wp_customize->add_setting( 'bonappetit_googledisplay', array (
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control(
'bonappetit_googledisplay',
array(
'section' => 'bonappetit_socialicons',
'label' => 'Display Social Network',
'type' => 'checkbox',
'default' => false,
)
);
// Yelp
$wp_customize->add_setting( 'bonappetit_yelp', array (
'sanitize_callback' => 'esc_url_raw',
'default' => esc_url( 'www.yelp.com' ),
'transport' => 'postMessage'
) );
$wp_customize->add_control( 'bonappetit_yelp',
array(
'label' => esc_html__( 'Yelp Icon', 'BonAppetit' ),
'description' => esc_html__( 'Add your Yelp URL', 'BonAppetit' ),
'section' => 'bonappetit_socialicons',
'settings' => 'bonappetit_yelp',
)
);
$wp_customize->add_setting( 'bonappetit_yelpdisplay', array (
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control(
'bonappetit_yelpdisplay',
array(
'section' => 'bonappetit_socialicons',
'label' => 'Display Social Network',
'type' => 'checkbox',
'default' => false,
)
);
// Restaurant Menu
$wp_customize->add_setting( 'bonappetit_rm', array (
'sanitize_callback' => 'esc_url_raw',
'default' => esc_url( '#' ),
'transport' => 'postMessage'
) );
$wp_customize->add_control( 'bonappetit_rm',
array(
'label' => esc_html__( 'Restaurant Menu Icon', 'BonAppetit' ),
'description' => esc_html__( 'Add a link to your menu', 'BonAppetit' ),
'section' => 'bonappetit_socialicons',
'settings' => 'bonappetit_rm',
)
);
$wp_customize->add_setting( 'bonappetit_rmdisplay', array (
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control(
'bonappetit_rmdisplay',
array(
'section' => 'bonappetit_socialicons',
'label' => 'Display Social Network',
'type' => 'checkbox',
'default' => false,
)
);
//Contact Details
$wp_customize->add_section( 'bonappetit_contactfront' , array(
'title' => __( 'Custom Contact Details', 'BonAppetit'),
'priority' => 3,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'description' => __('Frontpage contact details configuration', 'BonAppetit'),
'panel' => 'ba_frontpage',
) );
//Settings
//Phone Number
$wp_customize->add_setting( 'bonappetit_telephone_setting', array (
'default' => __( 'Your Telephone Number', 'BonAppetit' ),
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control( new bonappetit_Customize_Textarea_Control(
$wp_customize,
'bonappetit_telephone_setting',
array(
'label' => __( 'Telephone Number', 'BonAppetit' ),
'section' => 'bonappetit_contactfront',
'settings' => 'bonappetit_telephone_setting',
'sanitize_callback' => 'esc_textarea',
)));
//Address
$wp_customize->add_setting( 'bonappetit_address_setting', array (
'default' => __( 'Your Address', 'BonAppetit' ),
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control( new bonappetit_Customize_Textarea_Control(
$wp_customize,
'bonappetit_address_setting',
array(
'label' => __( 'Address', 'BonAppetit' ),
'section' => 'bonappetit_contactfront',
'settings' => 'bonappetit_address_setting',
'sanitize_callback' => 'esc_textarea',
)));
// E-Mail Address
$wp_customize->add_setting( 'bonappetit_ot_setting', array (
'default' => __( 'Your Opening Times', 'BonAppetit' ),
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control( new bonappetit_Customize_Textarea_Control(
$wp_customize,
'bonappetit_ot_setting',
array(
'label' => __( 'Opening Times', 'BonAppetit' ),
'section' => 'bonappetit_contactfront',
'settings' => 'bonappetit_ot_setting',
'sanitize_callback' => 'esc_textarea',
)));
//Frontpage Buttons
$wp_customize->add_section( 'bonappetit_buttonsfront' , array(
'title' => __( 'Custom Buttons', 'BonAppetit'),
'priority' => 4,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'description' => __('This buttons should be use for linking purposes. e.g. creating a link to the blog section or towards a pdf of a restaurant menu', 'BonAppetit'),
'panel' => 'ba_frontpage',
) );
//Settings
//Frontpage Button 1
//Button Text
$wp_customize->add_setting( 'bonappetit_buttontext_setting', array (
'default' => __( 'Your Text', 'BonAppetit' ),
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control( new bonappetit_Customize_Textarea_Control(
$wp_customize,
'bonappetit_buttontext_setting',
array(
'label' => __( 'Left Button Text', 'BonAppetit' ),
'section' => 'bonappetit_buttonsfront',
'settings' => 'bonappetit_buttontext_setting',
'sanitize_callback' => 'esc_textarea'
)));
//Button URL
$wp_customize->add_setting( 'bonappetit_buttonlink_setting', array (
'sanitize_callback' => 'esc_url_raw',
'default' => esc_url( '#' ),
'transport' => 'postMessage',
) );
$wp_customize->add_control( 'bonappetit_buttonlink_setting',
array(
'label' => esc_html__( 'Left Button URL', 'BonAppetit' ),
'description' => esc_html__( 'Add the URL for this button.', 'BonAppetit' ),
'section' => 'bonappetit_buttonsfront',
'settings' => 'bonappetit_buttonlink_setting',
'sanitize_callback' => 'esc_url_raw',
)
);
//Frontpage Button 2
$wp_customize->add_setting( 'bonappetit_buttontexttwo_setting', array (
'default' => __( 'Your Text', 'BonAppetit' ),
'sanitize_callback' => 'esc_textarea',
'transport'=>'postMessage'
) );
$wp_customize->add_control( new bonappetit_Customize_Textarea_Control(
$wp_customize,
'bonappetit_buttontexttwo_setting',
array(
'label' => __( 'Right Button Text', 'BonAppetit' ),
'section' => 'bonappetit_buttonsfront',
'settings' => 'bonappetit_buttontexttwo_setting',
'sanitize_callback' => 'esc_textarea',
)));
//Button URL
$wp_customize->add_setting( 'bonappetit_buttonlinktwo_setting', array (
'sanitize_callback' => 'esc_url_raw',
'default' => esc_url( '#' ),
'transport' => 'postMessage'
) );
$wp_customize->add_control( 'bonappetit_buttonlinktwo_setting',
array(
'label' => esc_html__( 'Right Button URL', 'BonAppetit' ),
'description' => esc_html__( 'Add the URL for this button.', 'BonAppetit' ),
'section' => 'bonappetit_buttonsfront',
'settings' => 'bonappetit_buttonlinktwo_setting',
'sanitize_callback' => 'esc_url_raw',
)
);
//Frontpage Slider
$wp_customize->add_section( 'bonappetit_imageslider' , array(
'title' => __( 'Image Slider', 'BonAppetit'),
'priority' => 5,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'description' => __('Frontpage elements configuration', 'BonAppetit'),
'panel' => 'ba_frontpage',
'description' => __('For the best results the uploaded images should not have a height bigger than 400px', 'BonAppetit'),
) );
$wp_customize-> add_setting ('bonappetit_imageslider_one', array (
'sanitize_callback' => 'esc_url_raw',
'default' => get_stylesheet_directory_uri() . '/images/slider.jpg',
'transport'=>'postMessage'
));
$wp_customize-> add_control (new wp_customize_image_control(
$wp_customize,
'bonappetit_imageslider_one', array (
'label'=> __('Upload Your First Image', 'BonAppetit'),
'section'=> 'bonappetit_imageslider',
'settings' => 'bonappetit_imageslider_one',
'sanitize_callback' => 'esc_url_raw',)
));
$wp_customize-> add_setting ('bonappetit_imageslider_two', array (
'sanitize_callback' => 'esc_url_raw',
'default' => get_stylesheet_directory_uri() . '/images/slider.jpg',
'transport'=>'postMessage'
));
$wp_customize-> add_control (new wp_customize_image_control(
$wp_customize,
'bonappetit_imageslider_two', array (
'label'=> __('Upload Your Second Image', 'BonAppetit'),
'section'=> 'bonappetit_imageslider',
'settings' => 'bonappetit_imageslider_two','sanitize_callback' => 'esc_url_raw', )
));
$wp_customize-> add_setting ('bonappetit_imageslider_three', array (
'sanitize_callback' => 'esc_url_raw',
'default' => get_stylesheet_directory_uri() . '/images/slider.jpg',
'transport'=>'postMessage'
));
$wp_customize-> add_control (new wp_customize_image_control(
$wp_customize,
'bonappetit_imageslider_three', array (
'label'=> __('Upload Your Third Image', 'BonAppetit'),
'section'=> 'bonappetit_imageslider',
'settings' => 'bonappetit_imageslider_three',
'sanitize_callback' => 'esc_url_raw', )
));
$wp_customize-> add_setting ('bonappetit_imageslider_four', array (
'sanitize_callback' => 'esc_url_raw',
'default' => get_stylesheet_directory_uri() . '/images/slider.jpg',
'transport'=>'postMessage'
));
$wp_customize-> add_control (new wp_customize_image_control(
$wp_customize,
'bonappetit_imageslider_four', array (
'label'=> __('Upload Your Forth Image', 'BonAppetit'),
'section'=> 'bonappetit_imageslider',
'settings' => 'bonappetit_imageslider_four',
'sanitize_callback' => 'esc_url_raw',)
));
}
add_action( 'customize_register', 'bonappetit_customize_register' );
}
/********************
Colours to Theme
*********************/
if ( ! function_exists( 'bonappetit_add_color_scheme' ) ) {
function bonappetit_add_color_scheme() {
/** Define Colours **/
$color_scheme1 = get_option('bonappetit_color1' );
$color_scheme2 = get_option('bonappetit_color2' );
$link_color1 = get_option('bonappetit_links_color1' );
$link_color2 = get_option('bonappetit_links_color2' );
/** Classes **/
?>