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 http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
add_image_size( 'thumb-small', 90, 90, true );
add_image_size( 'thumb-medium', 300, 210, true );
add_image_size( 'thumb-full', 750, 500, true );
add_image_size( 'thumb-featured', 250, 175, true );
add_image_size( 'thumb-featured-slider', 600, 400, true );
add_image_size( 'thumb-widget-tabs', 100, 100, true );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'ambision' ),
) );
// Enable support for Post Formats.
add_theme_support( 'post-formats', array('image', 'video', 'gallery' , 'quote', 'link', 'status') );
// Enable support for HTML5 markup.
add_theme_support( 'html5', array(
'comment-list',
'search-form',
'comment-form',
'gallery',
) );
}
endif; // ambision_setup
add_action( 'after_setup_theme', 'ambision_setup' );
/**
* Register widgetized area and update sidebar with default widgets.
*/
function ambision_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'ambision' ),
'id' => 'sidebar-1',
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar(array(
'id' => 'footer-widget-1',
'name' => __( 'Footer Widget 1', 'ambision' ),
'description' => __( 'Used for footer widget area', 'ambision' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
));
register_sidebar(array(
'id' => 'footer-widget-2',
'name' => __( 'Footer Widget 2', 'ambision' ),
'description' => __( 'Used for footer widget area', 'ambision' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
));
register_sidebar(array(
'id' => 'footer-widget-3',
'name' => __( 'Footer Widget 3', 'ambision' ),
'description' => __( 'Used for footer widget area', 'ambision' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
));
}
add_action( 'widgets_init', 'ambision_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function ambision_scripts() {
$protocol = is_ssl() ? 'https' : 'http';
$query_args = array(
'family' => 'Roboto+Slab:300,400,700',);
wp_enqueue_style( 'ambision-fonts', add_query_arg( $query_args, "$protocol://fonts.googleapis.com/css" ) );
wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/css/font-awesome.css' );
wp_enqueue_style( 'ambision-bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css' );
wp_enqueue_style( 'ambision-owl.carousel', get_template_directory_uri() . '/css/owl.carousel.css' );
wp_enqueue_style( 'ambision-owl.theme', get_template_directory_uri() . '/css/owl.theme.css' );
wp_enqueue_style( 'ambision-style', get_stylesheet_uri() );
wp_enqueue_style( 'ambision-dynamic-css' , get_template_directory_uri() . '/css/dynamic-css.php');
wp_enqueue_script( 'ambision-bootstrap.min', get_template_directory_uri().'/js/bootstrap.min.js', array('jquery') );
wp_enqueue_script( 'ambision-superfish', get_template_directory_uri() . '/js/superfish.js', array( 'jquery' ) );
wp_enqueue_script( 'ambision-supersubs', get_template_directory_uri() . '/js/supersubs.js', array( 'jquery' ) );
wp_enqueue_script( 'ambision-skip-link-focus-fix', get_template_directory_uri() .'/js/skip-link-focus-fix.js', array(), '', true );
wp_enqueue_script( 'ambision-owl.carousel', get_template_directory_uri() . '/js/owl.carousel.js', array( 'jquery' ),'', false );
wp_enqueue_script( 'ambision-scripts', get_template_directory_uri() . '/js/scripts.js', array( 'jquery' ), false );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'ambision_scripts' );
/**
* Mobile Menu Enqueue scripts and styles
*/
function ambision_responsive_menu()
{
//meanmenu
wp_enqueue_style('meanmenu', get_template_directory_uri() . '/css/meanmenu.css', 'style');
}
add_action('wp_enqueue_scripts', 'ambision_responsive_menu');
function ambision_custom_scripts_function() {
if ( !is_admin() ) {
wp_enqueue_script('jquery.min'); //Grabs the latest version of jQuery from WordPress
wp_register_script('meanmenu', get_template_directory_uri() . '/js/jquery.meanmenu.js', array('jquery'), false );
wp_enqueue_script('meanmenu');
}
}
add_action('wp_enqueue_scripts', 'ambision_custom_scripts_function');
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Add custom widgets
*/
get_template_part('inc/custom-widgets');
/* --------------------------------------------------------------
Post Meta
-------------------------------------------------------------- */
require_once(get_template_directory() . '/inc/theme-addons/post-meta/post-meta-fields.php');
/* --------------------------------------------------------------
Post Formats Preparation
-------------------------------------------------------------- */
function post_formats_preparation($post_format = '')
{
// Addons Path
$path = get_template_directory() . '/inc/theme-addons/post-formats/';
if($post_format != '')
{
switch($post_format)
{
case 'image' :
require($path . '/image.php');
break;
case 'video' :
require($path . '/video.php');
break;
case 'gallery' :
require($path . '/gallery.php');
break;
case 'quote' :
require($path . '/quote.php');
break;
case 'link' :
require($path . '/link.php');
break;
case 'status' :
require($path . '/status.php');
break;
}
}// end if
}
/* Excerpt length
/* ------------------------------------ */
if ( ! function_exists( 'ambision_post_excerpt_length' ) ) {
function ambision_post_excerpt_length( $length ) {
return ot_get_option('excerpt_length',$length);
}
}
add_filter( 'excerpt_length', 'ambision_post_excerpt_length', 999 );
/* TGM plugin activation
/* ------------------------------------ */
get_template_part('inc/class-tgm-plugin-activation');
function ambision_plugins() {
// Add the following plugins
$plugins = array(
array(
'name' => 'WP-PageNavi',
'slug' => 'wp-pagenavi',
'required' => false,
'force_activation' => false,
'force_deactivation'=> false,
),
);
tgmpa( $plugins );
}
add_action( 'tgmpa_register', 'ambision_plugins' );