__( 'Header Menu', 'vega' ),
'footer' => __( 'Footer Menu', 'vega' ),
) );
#custom header support
$args = array(
'flex-width' => true,
'width' => 1920,
'flex-height' => true,
'height' => 600,
'default-image' => $vega_wp_defaults['vega_wp_custom_header'],
);
add_theme_support( 'custom-header', $args );
#custom logo support
add_theme_support( 'custom-logo', array('height' => 45, 'width' => 165,'flex-height' => true,'flex-width' => true ) );
#page excerpts
add_post_type_support('page', 'excerpt');
}
add_action( 'after_setup_theme', 'vega_wp_setup' );
if ( ! isset( $content_width ) ) {
$content_width = 1200;
}
### FILTERS ###
function vega_wp_move_comment_field_to_bottom( $fields ) {
$comment_field = $fields['comment'];
unset( $fields['comment'] );
$fields['comment'] = $comment_field;
return $fields;
}
add_filter( 'comment_form_fields', 'vega_wp_move_comment_field_to_bottom' );
function vega_wp_excerpt_length( $length ) {
return 65;
}
add_filter( 'excerpt_length', 'vega_wp_excerpt_length', 999 );
### STYLES AND SCRIPTS ###
function vega_wp_scripts() {
/** CSS **/
#bootstrap, fontawesome, bootstrapsocial
wp_register_style('bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.css' );
wp_register_style('font-awesome', get_template_directory_uri().'/assets/css/font-awesome.min.css' );
wp_register_style('bootstrap-social', get_template_directory_uri().'/assets/css/bootstrap-social.css' );
#animate.css
wp_enqueue_style('animate-css', get_template_directory_uri().'/assets/css/animate.css');
#fonts
wp_enqueue_style('vega-wp-googlefont1',
'//fonts.googleapis.com/css?family=Poppins:300,400,500,600,700');
// wp_enqueue_style('vega-wp-googlefont2',
// '//fonts.googleapis.com/css?family=Lato:400,100,100italic,300,300italic,400italic,700,700italic,900,900italic');
#default stylesheet
$deps = array('bootstrap', 'font-awesome', 'bootstrap-social');
wp_enqueue_style('vega-wp-style', get_stylesheet_uri(), $deps );
#color scheme
$vega_wp_color_stylesheet = vega_wp_get_option('vega_wp_color_stylesheet');
wp_enqueue_style('vega-wp-color', get_stylesheet_directory_uri() . '/color-schemes/' . strtolower($vega_wp_color_stylesheet) . '.css');
// Load html5shiv.js
wp_enqueue_script( 'vega-html5', get_template_directory_uri() . '/assets/js/html5shiv.js', array('vega-wp-style'), '3.7.0' );
wp_script_add_data( 'vega-html5', 'conditional', 'lt IE 9' );
// Load respond.min.js
wp_enqueue_script( 'vega-respond', get_template_directory_uri() . '/assets/js/respond.min.js', array('vega-wp-style'), '1.3.0' );
wp_script_add_data( 'vega-html5', 'conditional', 'lt IE 9' );
/** Javascript **/
#bootstrap
wp_enqueue_script('bootstrap', get_template_directory_uri().'/assets/js/bootstrap.min.js', array('jquery'), '', true );
wp_enqueue_script('jquery-smartmenus', get_template_directory_uri() . '/assets/js/jquery.smartmenus.min.js', array('jquery'), '', true );
wp_enqueue_script('jquery-smartmenus-bootstrap', get_template_directory_uri() . '/assets/js/jquery.smartmenus.bootstrap.min.js', array('jquery'), '', true );
#animation
$vega_wp_animations = vega_wp_get_option('vega_wp_animations');
if($vega_wp_animations == 'Y') {
wp_enqueue_script('wow', get_template_directory_uri() . '/assets/js/wow.min.js', array('jquery'), '', true );
wp_enqueue_script('vega-wp-themejs-anim', get_template_directory_uri() . '/assets/js/vega-wp-anim.js', array('jquery'), '', true );
}
#parallax
wp_enqueue_script('parallax', get_template_directory_uri() . '/assets/js/parallax.min.js', array('jquery'), '', true );
#theme javascript
wp_enqueue_script('vega-wp-themejs', get_template_directory_uri() . '/assets/js/vega-wp.js', array('jquery'), '', true );
#comments
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'vega_wp_scripts' );
### CUSTOM CSS ###
function vega_wp_custom_css() {
$vega_wp_custom_css = vega_wp_get_option('vega_wp_custom_css');
echo '';
$output="";
echo $output;
echo '';
}
add_action('wp_head','vega_wp_custom_css');
### CUSTOMIZER STYLES ("Upgrade to Pro") ###
add_action( 'customize_controls_enqueue_scripts', 'vega_wp_custom_customize_enqueue' );
function vega_wp_custom_customize_enqueue() {
wp_enqueue_style( 'customizer-css', get_template_directory_uri() . '/customize/style.css' );
}
### WIDGETS ###
function vega_wp_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'vega' ),
'id' => 'sidebar',
'description' => __( 'Add widgets here to appear in your sidebar.', 'vega' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Col 1', 'vega' ),
'id' => 'footer_1',
'description' => __( 'Add widgets here to appear in the first column of the footer.', 'vega' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Col 2', 'vega' ),
'id' => 'footer_2',
'description' => __( 'Add widgets here to appear in the second column of the footer.', 'vega' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Col 3', 'vega' ),
'id' => 'footer_3',
'description' => __( 'Add widgets here to appear in the third column of the footer.', 'vega' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Col 4', 'vega' ),
'id' => 'footer_4',
'description' => __( 'Add widgets here to appear in the fourth column of the footer.', 'vega' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'vega_wp_widgets_init' );
### INCLUDES ###
#bootstrap nav walker
require get_template_directory() . '/includes/wp_bootstrap_navwalker.php';
#customizer
require get_template_directory() . '/customize/customizer.php';
### FUNCTIONS ###
#vega_wp_rand_page
function vega_wp_rand_page() {
$pages = get_pages();
if(!empty($pages)) {
shuffle($pages);
return $pages[0]->ID;
} else {
return false;
}
}
#vega_wp_title
function vega_wp_title() {
$title = '';
if( is_home() && get_option('page_for_posts') ) {
$title = get_page( get_option('page_for_posts') )->post_title;
}
else if ( is_page() ) {
$title = get_the_title(); if($title == '') $title = __("Page ID: ", 'vega') . get_the_ID();
}
else if ( is_single() ){
$title = get_the_title(); if($title == '') $title = __("Post ID: ", 'vega') . get_the_ID();
}
else if ( is_category() ) {
$title = single_cat_title('', false);
}
else if ( is_tag() ) {
$title = single_tag_title(__('Tag: ', 'vega'), false);
}
else if ( is_author() ) {
$title = __('Author: ', 'vega') . '' . get_the_author() . '';
}
else if ( is_day() ) {
$title = __('Day: ', 'vega') . '' . get_the_date() . '';
}
else if ( is_month() ) {
$title = __('Month: ', 'vega') . '' . get_the_date( _x( 'F Y', 'monthly archives date format', 'vega' ) ) . '';
}
else if ( is_year() ) {
$title = __('Year: ', 'vega') . '' . get_the_date( _x( 'Y', 'yearly archives date format', 'vega' ) ) . '';
}
else if ( is_404() ) {
$title = __('Not Found!', 'vega');
}
else if ( is_search() ) {
$title = __('Search Results: ', 'vega') . get_search_query();
}
else {
$title = __( 'Archives', 'vega' );
}
return $title;
}
#vega_wp_get_col_class
function vega_wp_get_col_class($n){
switch($n){
case 1: return 'col-md-12'; break;
case 2: return 'col-md-6'; break;
case 3: return 'col-md-4'; break;
case 4: return 'col-md-3'; break;
}
}
#vega_wp_get_option
function vega_wp_get_option($key){
global $vega_wp_defaults;
if (array_key_exists($key, $vega_wp_defaults))
$value = get_theme_mod($key, $vega_wp_defaults[$key]);
else
$value = get_theme_mod($key);
return $value;
}
### EXAMPLE/DEFAULTs CONTENT ###
#vega_wp_random_thumbnail
function vega_wp_random_thumbnail($size='default'){
global $vega_wp_defaults;
if($size == 'vega-post-thumbnail-recent')
$images = $vega_wp_defaults['vega_wp_recent_post_image'];
else if($size == 'full')
$images = $vega_wp_defaults['vega_wp_full_image'];
else
$images = $vega_wp_defaults['vega_wp_featured_image'];
$rand_key = array_rand($images, 1);
echo esc_url($images[$rand_key]);
}
#vega_wp_sequential_thumbnail
function vega_wp_sequential_thumbnail($size, $n){
global $vega_wp_defaults;
if($size == 'vega-post-thumbnail-recent')
$images = $vega_wp_defaults['vega_wp_recent_post_image'];
else
$images = $vega_wp_defaults['vega_wp_featured_image'];
echo esc_url($images[$n]);
}
#vega_wp_example_nav_header
function vega_wp_example_nav_header(){
$args = array('parent'=>0);
$pages = get_pages($args);
echo '';
echo '
';
}
#vega_wp_example_nav_footer
function vega_wp_example_nav_footer(){
$args = array('parent'=>0);
$pages = get_pages($args);
echo '';
}
#vega_wp_example_frontpage_content
function vega_wp_example_frontpage_content(){
$random_page_id = vega_wp_rand_page();
$random_page = get_post( $random_page_id );
echo '' . esc_html($random_page->post_title) . '
';
echo ''. $random_page->post_content .'
';
}
#vega_wp_example_sidebar_footer
function vega_wp_example_sidebar_footer(){
echo '';
}
#vega_wp_example_sidebar
function vega_wp_example_sidebar(){
echo '';
}
// polylang
pll_register_string('copyright', 'copyright', 'footer', true);
pll_register_string('topnav', 'topnav', 'header', true);
?>