'ffffff',
));
add_image_size( 'personal-gym-trainer-featured-image', 2000, 1200, true );
add_image_size( 'personal-gym-trainer-thumbnail-avatar', 100, 100, true );
$GLOBALS['content_width'] = 525;
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'personal-gym-trainer' ),
) );
add_theme_support( 'html5', array(
'comment-form',
'comment-list',
'gallery',
'caption',
) );
// Add theme support for Custom Logo.
add_theme_support( 'custom-logo', array(
'width' => 250,
'height' => 250,
'flex-width' => true,
'flex-height' => true,
) );
/*
* This theme styles the visual editor to resemble the theme style,
* specifically font, colors, and column width.
*/
add_editor_style( array( 'assets/css/editor-style.css', fitness_insight_fonts_url() ) );
}
add_action( 'after_setup_theme', 'personal_gym_trainer_setup' );
// widgets
function personal_gym_trainer_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'personal-gym-trainer' ),
'id' => 'sidebar-1',
'description' => __( 'Add widgets here to appear in your sidebar on blog posts and archive pages.', 'personal-gym-trainer' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Page Sidebar', 'personal-gym-trainer' ),
'id' => 'sidebar-2',
'description' => __( 'Add widgets here to appear in your pages and posts', 'personal-gym-trainer' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Sidebar 3', 'personal-gym-trainer' ),
'id' => 'sidebar-3',
'description' => __( 'Add widgets here to appear in your sidebar on blog posts and archive pages.', 'personal-gym-trainer' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer 1', 'personal-gym-trainer' ),
'id' => 'footer-1',
'description' => __( 'Add widgets here to appear in your footer.', 'personal-gym-trainer' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer 2', 'personal-gym-trainer' ),
'id' => 'footer-2',
'description' => __( 'Add widgets here to appear in your footer.', 'personal-gym-trainer' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer 3', 'personal-gym-trainer' ),
'id' => 'footer-3',
'description' => __( 'Add widgets here to appear in your footer.', 'personal-gym-trainer' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer 4', 'personal-gym-trainer' ),
'id' => 'footer-4',
'description' => __( 'Add widgets here to appear in your footer.', 'personal-gym-trainer' ),
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'personal_gym_trainer_widgets_init' );
// remove sections
function personal_gym_trainer_customize_register() {
global $wp_customize;
$wp_customize->remove_section( 'fitness_insight_pro' );
$wp_customize->remove_setting('fitness_insight_footer_text');
$wp_customize->remove_control('fitness_insight_footer_text');
}
add_action( 'customize_register', 'personal_gym_trainer_customize_register', 11 );
// customizer
function personal_gym_trainer_customize( $wp_customize ) {
wp_enqueue_style('customizercustom_css', esc_url( get_stylesheet_directory_uri() ). '/assets/css/customizer.css');
require get_theme_file_path( 'inc/custom-control.php' );
// pro section
$wp_customize->add_section('personal_gym_trainer_pro', array(
'title' => __('UPGRADE GYM TRAINER PREMIUM', 'personal-gym-trainer'),
'priority' => 1,
));
$wp_customize->add_setting('personal_gym_trainer_pro', array(
'default' => null,
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control(new Personal_Gym_Trainer_Pro_Control($wp_customize, 'personal_gym_trainer_pro', array(
'label' => __('GYM TRAINER PREMIUM', 'personal-gym-trainer'),
'section' => 'personal_gym_trainer_pro',
'settings' => 'personal_gym_trainer_pro',
'priority' => 1,
)));
// BMI Section
$wp_customize->add_section('fitness_insight_bmi_section',array(
'title' => __('BMI Settings', 'personal-gym-trainer'),
'priority' => 6,
'panel' => 'fitness_insight_custompage_panel',
) );
$wp_customize->add_setting( 'fitness_insight_section_bmi_heading', array(
'default' => '',
'transport' => 'refresh',
'sanitize_callback' => 'sanitize_text_field',
) );
$wp_customize->add_control( new Personal_Gym_Trainer_Customizer_Customcontrol_Section_Heading( $wp_customize, 'fitness_insight_section_bmi_heading', array(
'label' => esc_html__( 'BMI Calculator Settings', 'personal-gym-trainer' ),
'section' => 'fitness_insight_bmi_section',
'settings' => 'fitness_insight_section_bmi_heading',
) ) );
$wp_customize->add_setting(
'personal_gym_trainer_calculator_show_hide',
array(
'type' => 'option',
'capability' => 'edit_theme_options',
'theme_supports' => '',
'default' => '',
'transport' => 'refresh',
'sanitize_callback' => 'fitness_insight_callback_sanitize_switch',
)
);
$wp_customize->add_control(
new Personal_Gym_Trainer_Customizer_Customcontrol_Switch(
$wp_customize,
'personal_gym_trainer_calculator_show_hide',
array(
'settings' => 'personal_gym_trainer_calculator_show_hide',
'section' => 'fitness_insight_bmi_section',
'label' => __( 'Check To Show Section', 'personal-gym-trainer' ),
'choices' => array(
'1' => __( 'On', 'personal-gym-trainer' ),
'off' => __( 'Off', 'personal-gym-trainer' ),
),
'active_callback' => '',
)
)
);
$wp_customize->add_setting('personal_gym_trainer_calculator_main_heading',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('personal_gym_trainer_calculator_main_heading',array(
'label' => esc_html__('Add Section Title','personal-gym-trainer'),
'section' => 'fitness_insight_bmi_section',
'setting' => 'personal_gym_trainer_calculator_main_heading',
'type' => 'text'
));
$wp_customize->selective_refresh->add_partial( 'personal_gym_trainer_calculator_main_heading', array(
'selector' => '#calculator h3',
'render_callback' => 'fitness_insight_customize_partial_personal_gym_trainer_calculator_main_heading',
) );
$wp_customize->add_setting('personal_gym_trainer_calculator_left_title',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('personal_gym_trainer_calculator_left_title',array(
'label' => esc_html__('Add Calculator Title','personal-gym-trainer'),
'section' => 'fitness_insight_bmi_section',
'setting' => 'personal_gym_trainer_calculator_left_title',
'type' => 'text'
));
$wp_customize->add_setting('personal_gym_trainer_calculator_left_text',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('personal_gym_trainer_calculator_left_text',array(
'label' => esc_html__('Add Calculator Text','personal-gym-trainer'),
'section' => 'fitness_insight_bmi_section',
'setting' => 'personal_gym_trainer_calculator_left_text',
'type' => 'text'
));
$wp_customize->add_setting('personal_gym_trainer_calculator_right_title',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('personal_gym_trainer_calculator_right_title',array(
'label' => esc_html__('Add BMI Chart Title','personal-gym-trainer'),
'section' => 'fitness_insight_bmi_section',
'setting' => 'personal_gym_trainer_calculator_right_title',
'type' => 'text'
));
$wp_customize->add_setting('personal_gym_trainer_calculator_left_heading',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('personal_gym_trainer_calculator_left_heading',array(
'label' => esc_html__('Add Chart heading Left','personal-gym-trainer'),
'section' => 'fitness_insight_bmi_section',
'setting' => 'personal_gym_trainer_calculator_left_heading',
'type' => 'text'
));
$wp_customize->add_setting('personal_gym_trainer_calculator_right_heading',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('personal_gym_trainer_calculator_right_heading',array(
'label' => esc_html__('Add Chart heading Right','personal-gym-trainer'),
'section' => 'fitness_insight_bmi_section',
'setting' => 'personal_gym_trainer_calculator_right_heading',
'type' => 'text'
));
$wp_customize->add_setting('personal_gym_trainer_bmi_chart_count',array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('personal_gym_trainer_bmi_chart_count',array(
'label' => esc_html__('Add No of Chart Text','personal-gym-trainer'),
'description' => esc_html__('Incarease the count and then publish the settings, then reload the page.','personal-gym-trainer'),
'section' => 'fitness_insight_bmi_section',
'setting' => 'personal_gym_trainer_bmi_chart_count',
'type' => 'number'
));
$personal_gym_trainer_chart_number = get_theme_mod('personal_gym_trainer_bmi_chart_count');
for($personal_gym_trainer_i=1; $personal_gym_trainer_i<=$personal_gym_trainer_chart_number; $personal_gym_trainer_i++) {
$wp_customize->add_setting('personal_gym_trainer_list_left'.$personal_gym_trainer_i,array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('personal_gym_trainer_list_left'.$personal_gym_trainer_i,array(
'label' => esc_html__('Add Chart Left Text ','personal-gym-trainer').$personal_gym_trainer_i,
'section' => 'fitness_insight_bmi_section',
'setting' => 'personal_gym_trainer_list_left'.$personal_gym_trainer_i,
'type' => 'text'
));
$wp_customize->add_setting('personal_gym_trainer_list_right'.$personal_gym_trainer_i,array(
'default' => '',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('personal_gym_trainer_list_right'.$personal_gym_trainer_i,array(
'label' => esc_html__('Add Chart Right Text ','personal-gym-trainer').$personal_gym_trainer_i,
'section' => 'fitness_insight_bmi_section',
'setting' => 'personal_gym_trainer_list_right'.$personal_gym_trainer_i,
'type' => 'text'
));
}
$wp_customize->add_setting('personal_gym_trainer_footer_text',array(
'default' => 'Gym Trainer WordPress Theme',
'sanitize_callback' => 'sanitize_text_field'
));
$wp_customize->add_control('personal_gym_trainer_footer_text',array(
'label' => esc_html__('Copyright Text','personal-gym-trainer'),
'section' => 'fitness_insight_footer_copyright',
'type' => 'textarea'
));
$wp_customize->selective_refresh->add_partial( 'personal_gym_trainer_footer_text', array(
'selector' => '.site-info a',
'render_callback' => 'fitness_insight_customize_partial_personal_gym_trainer_footer_text',
) );
}
add_action( 'customize_register', 'personal_gym_trainer_customize' );
// comments
function personal_gym_trainer_enqueue_comments_reply() {
if( is_singular() && comments_open() && ( get_option( 'thread_comments' ) == 1) ) {
// Load comment-reply.js (into footer)
wp_enqueue_script( 'comment-reply', '/wp-includes/js/comment-reply.min.js', array(), false, true );
}
}
add_action( 'wp_enqueue_scripts', 'personal_gym_trainer_enqueue_comments_reply' );
// Footer Text
function personal_gym_trainer_copyright_link() {
$personal_gym_trainer_footer_text = get_theme_mod('personal_gym_trainer_footer_text', esc_html__('Gym Trainer WordPress Theme', 'personal-gym-trainer'));
$personal_gym_trainer_credit_link = esc_url('https://www.ovationthemes.com/wordpress/free-gym-trainer-wordpress-theme/');
echo '' . esc_html($personal_gym_trainer_footer_text) . '';
}
define('PERSONAL_GYM_TRAINER_PRO_LINK',__('https://www.ovationthemes.com/wordpress/personal-gym-trainer-wordpress-theme/','personal-gym-trainer'));
if ( ! defined( 'FITNESS_INSIGHT_SUPPORT' ) ) {
define('FITNESS_INSIGHT_SUPPORT',__('https://wordpress.org/support/theme/personal-gym-trainer','personal-gym-trainer'));
}
if ( ! defined( 'FITNESS_INSIGHT_REVIEW' ) ) {
define('FITNESS_INSIGHT_REVIEW',__('https://wordpress.org/support/theme/personal-gym-trainer/reviews/#new-post','personal-gym-trainer'));
}
if ( ! defined( 'FITNESS_INSIGHT_LIVE_DEMO' ) ) {
define('FITNESS_INSIGHT_LIVE_DEMO',__('https://www.ovationthemes.com/demos/personal-gym-trainer/','personal-gym-trainer'));
}
if ( ! defined( 'FITNESS_INSIGHT_BUY_PRO' ) ) {
define('FITNESS_INSIGHT_BUY_PRO',__('https://www.ovationthemes.com/wordpress/personal-gym-trainer-wordpress-theme/','personal-gym-trainer'));
}
if ( ! defined( 'FITNESS_INSIGHT_PRO_DOC' ) ) {
define('FITNESS_INSIGHT_PRO_DOC',__('https://ovationthemes.com/docs/ot-fitness-insight-pro/','personal-gym-trainer'));
}
if ( ! defined( 'FITNESS_INSIGHT_FREE_DOC' ) ) {
define('FITNESS_INSIGHT_FREE_DOC',__('https://ovationthemes.com/docs/ot-personal-gym-trainer-free-doc','personal-gym-trainer'));
}
if ( ! defined( 'FITNESS_INSIGHT_THEME_NAME' ) ) {
define('FITNESS_INSIGHT_THEME_NAME',__('Premium Personal Gym Trainer Theme','personal-gym-trainer'));
}
/* Pro control */
if (class_exists('WP_Customize_Control') && !class_exists('Personal_Gym_Trainer_Pro_Control')):
class Personal_Gym_Trainer_Pro_Control extends WP_Customize_Control{
public function render_content(){?>