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' );
add_image_size('blog-page', 732,999, true);
set_post_thumbnail_size( 220, 155, true );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary Menu', 'apweb' ),
'secondy' => esc_html__( 'Secondy Menu', 'apweb'),
'footer-menu'=>esc_html__('Footer Menu', 'apweb'),
) );
/*
* 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',
) );
/*
* Enable support for Post Formats.
* See https://developer.wordpress.org/themes/functionality/post-formats/
*/
add_theme_support( 'post-formats', array(
'aside',
'image',
'video',
'quote',
'link',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'apweb_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
}
endif; // apweb_setup
add_action( 'after_setup_theme', 'apweb_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 apweb_content_width() {
$GLOBALS['content_width'] = apply_filters( 'apweb_content_width', 640 );
}
add_action( 'after_setup_theme', 'apweb_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function apweb_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'apweb' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__('Sidebar Footer', 'apweb' ),
'id' => 'sidebar-footer',
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'apweb_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function apweb_scripts() {
wp_enqueue_style( 'apweb-style', get_stylesheet_uri() );
$protocol = is_ssl() ? 'https' : 'http';
wp_enqueue_style('google-raleway', "$protocol://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800");
// load bootstrap css
wp_enqueue_style( 'apweb-bootstrap', get_template_directory_uri() . '/includes/resources/bootstrap/css/bootstrap.css' );
if(of_get_option('enable_swipebox')) { //check if enable swipebox from theme options
wp_enqueue_style( 'apweb-swipebox', get_template_directory_uri() . '/includes/css/swipebox.css' );
}
wp_enqueue_style( 'apweb-owl-carousel', get_template_directory_uri() . '/includes/css/owl.carousel.css' );
wp_enqueue_style( 'apweb-owl-theme', get_template_directory_uri() . '/includes/css/owl.theme.css' );
wp_enqueue_style( 'apweb-woo-theme', get_template_directory_uri() . '/includes/css/woo.css' );
wp_enqueue_style( 'apweb-animations', get_template_directory_uri() . '/includes/css/animations.css' );
wp_enqueue_style( 'apweb-meanmenu', get_template_directory_uri() . '/includes/css/meanmenu.css' );
wp_enqueue_style( 'apweb-main', get_template_directory_uri() . '/includes/css/main.css' );
// load bootstrap js
wp_enqueue_script('apweb-bootstrapjs', get_template_directory_uri().'/includes/resources/bootstrap/js/bootstrap.js', array('jquery') );
// load bootstrap wp js
wp_enqueue_script( 'apweb-bootstrapwp', get_template_directory_uri() . '/includes/js/bootstrap-wp.js', array('jquery') );
wp_enqueue_script( 'apweb-skip-link-focus-fix', get_template_directory_uri() . '/includes/js/skip-link-focus-fix.js', array(), '20130115', true );
wp_enqueue_script( 'apweb-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
wp_enqueue_script( 'apweb-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
if ( is_singular() && wp_attachment_is_image() ) {
wp_enqueue_script( 'apweb-keyboard-image-navigation', get_template_directory_uri() . '/includes/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
}
wp_enqueue_script( 'apweb-smoothscroll', get_template_directory_uri() . '/includes/js/smoothscroll.js', array('jquery') );
if(of_get_option('enable_swipebox')) { //check if enable swipebox from theme options
wp_enqueue_script( 'apweb-swipebox', get_template_directory_uri() . '/includes/js/jquery.swipebox.js', array('jquery') );
wp_enqueue_script( 'apweb-swipebox-config', get_template_directory_uri() . '/includes/js/swipebox-config.js', array('jquery') );
}
wp_enqueue_script( 'apweb-owl-carousel', get_template_directory_uri() . '/includes/js/owl.carousel.js', array('jquery') );
wp_enqueue_script( 'apweb-appear', get_template_directory_uri() . '/includes/js/jquery.appear.js', array('jquery') );
wp_enqueue_script( 'apweb-meanmenu', get_template_directory_uri() . '/includes/js/jquery.meanmenu.js', array('jquery') );
wp_enqueue_script( 'apweb-velocity', get_template_directory_uri() . '/includes/js/jquery.velocity.js', array('jquery') );
wp_enqueue_script( 'apweb-appear-config', get_template_directory_uri() . '/includes/js/appear.config.js', array('jquery') );
// Theme main js
wp_enqueue_script( 'apweb-themejs', get_template_directory_uri() . '/includes/js/main.js', array('jquery') );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'apweb_scripts' );
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/includes/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/includes/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/includes/extras.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/includes/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/includes/jetpack.php';
/* Theme Social media icons */
if( !function_exists( 'apweb_socialmedia_navs' ) ){
function apweb_socialmedia_navs() {
return array(
'twitter_url' => 'fa fa-twitter',
'facebook_url' => 'fa fa-facebook',
'google_plus_url' => 'fa fa-google-plus',
'linkedin_url' => 'fa fa-linkedin',
'instagram_url' => 'fa fa-instagram',
'youtube_url' => 'fa fa-youtube',
'skype_url' => 'fa fa-skype',
'dribbble_url' => 'fa fa-dribbble',
'digg_url' => 'fa fa-digg',
'github_url' => 'fa fa-github',
'delicious_url' => 'fa fa-delicious',
'reddit_url' => 'fa fa-reddit',
'pinterest_url' => 'fa fa-pinterest',
'flickr_url' => 'fa fa-flickr',
'rss_url' => 'fa fa-rss'
);
}
}
/* Theme Home Slider */
if( !function_exists( 'apweb_home_slider' ) ){
function apweb_home_slider() {
return array(
'item_1' => array(
'image' => 'slider_image_1',
'description' => 'slider_description_1'
),
'item_2' => array(
'image' => 'slider_image_2',
'description' => 'slider_description_2'
),
'item_3' => array(
'image' => 'slider_image_3',
'description' => 'slider_description_3'
),
'item_4' => array(
'image' => 'slider_image_4',
'description' => 'slider_description_4'
),
'item_5' => array(
'image' => 'slider_image_5',
'description' => 'slider_description_5'
),
);
}
}
if( !function_exists( 'apweb_theme_option_custom_style' ) ) {
function apweb_theme_option_custom_style() {
?>
post_type) {
case 'page':
add_editor_style('woo.css');
break;
case 'post':
add_editor_style('main.css');
break;
}
}
add_action( 'admin_head', 'my_editor_style' );