tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'menu-1' => esc_html__( 'Primary', 'avakfitness' ),
'footer-menu'=>esc_html__('Footer Menu','avakfitness'),
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'avakfitness_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support( 'custom-logo', array(
'height' => 250,
'width' => 250,
'flex-width' => true,
'flex-height' => true,
) );
}
endif;
add_action( 'after_setup_theme', 'avakfitness_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function avakfitness_content_width() {
$GLOBALS['content_width'] = apply_filters( 'avakfitness_content_width', 640 );
}
add_action( 'after_setup_theme', 'avakfitness_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function avakfitness_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'avakfitness' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'avakfitness' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar(
array(
'name' => __('Sidebar - Common', 'avakfitness'),
'id' => 'sidebar-common',
'description' => __('Common Sidebar', 'avakfitness'),
'before_widget' => '',
'before_title' => ''
)
);
register_sidebar(
array(
'name' => __('Footer Widget 1', 'avakfitness'),
'id' => 'footer-widget1',
'description' => __('Footer Widget 1', 'avakfitness'),
'before_widget' => '',
'before_title' => ''
)
);
register_sidebar(
array(
'name' => __('Footer Widget 2', 'avakfitness'),
'id' => 'footer-widget2',
'description' => __('Footer Widget 2', 'avakfitness'),
'before_widget' => '',
'before_title' => ''
)
);
}
add_action( 'widgets_init', 'avakfitness_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function avakfitness_scripts() {
wp_enqueue_style( 'avakfitness-style', get_stylesheet_uri() );
wp_enqueue_style('mfc_mainfont', 'http://fonts.googleapis.com/css?family=Arimo:400,700,400italic,700italic|Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800&subset=latin,greek-ext,greek,vietnamese,latin-ext,cyrillic,cyrillic-ext)');
wp_enqueue_style('mfc_maincss', get_template_directory_uri(). '/assets/css/style.css');
wp_enqueue_style('mfc_gridcss', get_template_directory_uri(). '/assets/css/grid.css');
wp_enqueue_style('mfc_fontscss', get_template_directory_uri(). '/assets/css/fonts.css');
wp_enqueue_style('mfc_flexslidercss', get_template_directory_uri(). '/assets/css/flexslider.css');
// wp_enqueue_script( 'avakfitness-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
// wp_enqueue_script( 'avakfitness-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
wp_enqueue_script('mfc_jquery', get_template_directory_uri(). '/assets/js/jquery-1.10.2.min.js','','',true);
wp_enqueue_script('mfc_flexslider', get_template_directory_uri(). '/assets/js/jquery.flexslider.js',array('jquery'),'',true);
wp_enqueue_script('mfc_masonry', get_template_directory_uri(). '/assets/js/masonry.pkgd.js', '','',true);
wp_enqueue_script('mfc_meanmenu', get_template_directory_uri(). '/assets/js/jquery.meanmenu.js', array('jquery'),'',true);
wp_enqueue_script('mfc_customjquery', get_template_directory_uri(). '/assets/js/jquery-ui-1.10.3.custom.min.js', array('jquery'),'',true);
wp_enqueue_script('mfc_base', get_template_directory_uri(). '/assets/js/base.js', array('jquery'),'',true);
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'avakfitness_scripts' );
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Functions which enhance the theme by hooking into WordPress.
*/
require get_template_directory() . '/inc/template-functions.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
if ( defined( 'JETPACK__VERSION' ) ) {
require get_template_directory() . '/inc/jetpack.php';
}
function hk_trim_content($limit)
{
$content = explode(' ', get_the_excerpt(), $limit);
if (count($content ) >= $limit) {
array_pop( $content);
$content = implode(" ", $content) . '...';
} else {
$content = implode(" ", $content);
}
$content = preg_replace('/\[.+\]/', '', $content );
$content = apply_filters('the_excerpt', $content);
return $content;
}
add_action( 'customize_register', 'olsen_light_child_customize_register' );
function olsen_light_child_customize_register( WP_Customize_Manager $wp_customize ) {
require_once get_stylesheet_directory() . '/customizer-controls/dropdown-category.php';
$wp_customize->add_section( 'homepage', array(
'title' => esc_html_x( 'Homepage Settings', 'customizer section title', 'avakfitness' ),
'panel' => 'mfc_theme_option',
'priority' =>29,
) );
$wp_customize->add_setting( 'home_slider_category', array(
'default' => 0,
'sanitize_callback' => 'absint',
) );
$wp_customize->add_control( new My_Dropdown_Category_Control( $wp_customize, 'home_slider_category', array(
'section' => 'homepage',
'label' => esc_html__( 'Slider posts category', 'avakfitness' ),
'description' => esc_html__( 'Select the category that the slider will show posts from. ', 'avakfitness' ),
) ) );
$wp_customize->add_setting( 'category-first', array(
'default' => 1,
'sanitize_callback' => 'wp_filter_nohtml_kses',
) );
$wp_customize->add_control( 'category-first', array(
'label' => __( 'First Category Title', 'avakfitness' ),
'section' => 'homepage',
'type' => 'text',
'description' => esc_html__( 'Enter Category First Heading ', 'avakfitness' ),
));
$wp_customize->add_setting( 'services', array(
'default' => 1,
'sanitize_callback' => 'absint',
) );
$wp_customize->add_control( new My_Dropdown_Category_Control( $wp_customize, 'services', array(
'section' => 'homepage',
'label' => esc_html__( 'First Category', 'avakfitness' ),
'description' => esc_html__( 'Select the category that the slider will show posts from.', 'avakfitness' ),
) ));
$wp_customize->add_setting( 'category-second-name', array(
'default' => 1,
'sanitize_callback' => 'wp_filter_nohtml_kses',
) );
$wp_customize->add_control( 'category-second-name', array(
'label' => __( 'Second Category Title', 'avakfitness' ),
'section' => 'homepage',
'type' => 'text',
));
$wp_customize->add_setting( 'category-second', array(
'default' => 1,
'sanitize_callback' => 'absint',
) );
$wp_customize->add_control( new My_Dropdown_Category_Control( $wp_customize, 'category-second', array(
'section' => 'homepage',
'label' => esc_html__( 'Second Category', 'avakfitness' ),
'description' => esc_html__( 'Select the category that the slider will show posts from. ', 'avakfitness' ),
)));
}