array(
'title' => esc_html__( 'Behance', 'artistas' ),
'class' => 'fa fa-behance'
),
'dribbble' => array(
'title' => esc_html__( 'Dribbble', 'artistas' ),
'class' => 'fa fa-dribbble'
),
'facebook' => array(
'title' => esc_html__( 'Facebook', 'artistas' ),
'class' => 'fa fa-facebook'
),
'flickr' => array(
'title' => esc_html__( 'Flickr', 'artistas' ),
'class' => 'fa fa-flickr'
),
'google_plus' => array(
'title' => esc_html__( 'Google Plus', 'artistas' ),
'class' => 'fa fa-google-plus'
),
'instagram' => array(
'title' => esc_html__( 'Instagram', 'artistas' ),
'class' => 'fa fa-instagram'
),
'linkedin' => array(
'title' => esc_html__( 'Linkedin', 'artistas' ),
'class' => 'fa fa-linkedin'
),
'mail' => array(
'title' => esc_html__( 'Mail', 'artistas' ),
'class' => 'fa fa-envelope'
),
'pinterest' => array(
'title' => esc_html__( 'Pinterest', 'artistas' ),
'class' => 'fa fa-pinterest'
),
'skype' => array(
'title' => esc_html__( 'Skype', 'artistas' ),
'class' => 'fa fa-skype'
),
'tumblr' => array(
'title' => esc_html__( 'Tumblr', 'artistas' ),
'class' => 'fa fa-tumblr'
),
'twitter' => array(
'title' => esc_html__( 'Twitter', 'artistas' ),
'class' => 'fa fa-twitter'
),
'vimeo' => array(
'title' => esc_html__( 'Vimeo', 'artistas' ),
'class' => 'fa fa-vimeo-square'
),
'yahoo' => array(
'title' => esc_html__( 'Yahoo', 'artistas' ),
'class' => 'fa fa-yahoo'
),
'youtube' => array(
'title' => esc_html__( 'Youtube', 'artistas' ),
'class' => 'fa fa-youtube'
)
);
$artistas_theme_options = artistas_get_theme_options();
$languages_folder = trailingslashit( get_template_directory_uri() ) . '/languages';
load_theme_textdomain( 'artistas', $languages_folder );
/* Insert RSS Feed link */
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'custom-header' );
add_theme_support( 'custom-background' );
/* Post format */
add_theme_support( 'post-formats', array( 'image', 'gallery', 'audio', 'quote', 'video' ) );
/* Add post thumbnail */
add_theme_support( 'post-thumbnails' );
/* Add title tag */
add_theme_support( 'title-tag' );
/* Create menu */
add_theme_support( 'menus' );
add_image_size( 'artistas_1200x800', 1200, 800 );
add_image_size( 'artistas_600x400', 600, 400 );
register_nav_menu( 'artistas-main-menu', esc_html__( 'Artistas Main Menu', 'artistas' ) );
$GLOBALS['content_width'] = 1200;
}
function artistas_get_theme_options () {
$artistas_theme_options = (array)get_option( 'artistas_theme_options' );
$artistas_default = array();
foreach ( ArtistasThemeOptions::config_options() as $section ) {
foreach ( $section['fields'] as $setting ) {
if ( isset( $setting['default'] ) ) {
$artistas_default[ $setting['id'] ] = $setting['default'];
} else {
$artistas_default[ $setting['id'] ] = '';
}
}
}
$artistas_theme_options = array_merge( $artistas_default, $artistas_theme_options );
return $artistas_theme_options;
}
function artistas_widget_init () {
/* Create sidebars */
$artistas_main_sidebar = array(
'name' => esc_html__( 'Artistas Main Sidebar', 'artistas' ),
'id' => 'artistas-main-sidebar',
'description' => esc_html__( 'Main sidebar for theme Artistas', 'artistas' ),
'class' => 'artistas-main-sidebar',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => ''
);
$artistas_left_sidebar = array(
'name' => esc_html__( 'Artistas Left Sidebar', 'artistas' ),
'id' => 'artistas-left-sidebar',
'description' => esc_html__( 'The sidebar is set in the left of site', 'artistas' ),
'class' => 'artistas-left-sidebar',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
);
register_sidebar( $artistas_main_sidebar );
register_sidebar( $artistas_left_sidebar );
}
function artistas_enqueue_assets () {
wp_register_style( 'fontawesome', trailingslashit( get_template_directory_uri() ) . 'assets/css/libs/font-awesome.min.css', '', null, 'all' );
wp_register_style( 'owlcarousel', trailingslashit( get_template_directory_uri() ) . 'assets/css/libs/owl.carousel.css', '', null, 'all' );
wp_register_style( 'artistas-styles', trailingslashit( get_template_directory_uri() ) . 'assets/css/style.css', '', null, 'all' );
wp_register_script( 'owlcarousel', trailingslashit( get_template_directory_uri() ) . 'assets/js/libs/owl.carousel.min.js', array( 'jquery' ), null, true );
wp_register_script( 'masonry', trailingslashit( get_template_directory_uri() ) . 'assets/js/libs/masonry.min.js', array( 'jquery' ), null, true );
wp_register_script( 'artistas-scripts', trailingslashit( get_template_directory_uri() ) . 'assets/js/scripts.js', array( 'jquery' ), null, true );
if ( ! wp_style_is( 'fontawesome' ) ) {
wp_enqueue_style( 'fontawesome' );
}
if ( ! wp_style_is( 'owlcarousel' ) ) {
wp_enqueue_style( 'owlcarousel' );
wp_enqueue_script( 'owlcarousel' );
}
wp_enqueue_style( 'artistas-styles' );
wp_enqueue_script( 'masonry' );
wp_enqueue_script( 'artistas-scripts' );
if ( is_singular() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
/* Google Font Default Of Template */
$query_args = array(
'family' => urlencode( 'Lato:400,700|PT Sans:400,700|Josefin Sans' ),
'subset' => 'latin,latin-ext'
);
wp_register_style( 'google-fonts', add_query_arg( $query_args, "//fonts.googleapis.com/css" ), array(), null );
wp_enqueue_style( 'google-fonts' );
}
function artistas_custom_css () {
/* Add Custom Google Font */
global $artistas_theme_options,
$artistas_elements;
$artistas_elements = array(
'body' => 'body',
'menu' => '.menu-list, .sub-menu',
'title' => '.title, .widget-title, .kd-about h2.title, .widget .title',
'logo' => '#header .wrap-logo .logo a',
'slogan' => '#header.wrap-logo .slogan',
'footer_logo' => '#footer .wrap-logo .logo a',
'footer_slogan' => '#footer .wrap-logo .slogan'
);
$fonts = array();
foreach ( $artistas_elements as $font ) {
$font .= '_font';
if ( ! empty( $artistas_theme_options[ $font ] ) && is_array( $artistas_theme_options[ $font ] ) ) {
$google_font = $artistas_theme_options[ $font ];
$family = '';
if ( ! empty( $google_font['font-family'] ) && ! empty( $google_font['google'] ) && $google_font['google'] === 'true' ) {
$family .= $google_font['font-family'];
if ( ! empty( $google_font['font-weight'] ) ) {
$family .= ':' . $google_font['font-weight'];
if ( ! empty( $google_font['font-style'] ) ) {
$family .= $google_font['font-style'];
}
}
}
if ( ! empty( $family ) && ! in_array( $family, $fonts ) ) {
$fonts[] = $family;
}
}
}
if ( ! empty( $fonts ) ) {
$fonts = implode( '|', $fonts );
$fonts = array(
'family' => urlencode( $fonts ),
'subset' => 'latin,latin-ext'
);
wp_register_style( 'artistas-add-google-fonts', add_query_arg( $fonts, "//fonts.googleapis.com/css" ), array(), null );
wp_enqueue_style( 'artistas-add-google-fonts' );
}
/* Add custom css */
$custom_css = '';
if ( ! empty( $artistas_theme_options['custom_css'] ) ) {
$custom_css .= ' ' . esc_attr( $artistas_theme_options['custom_css'] );
}
// Element settings font
$custom_css .= artistas_custom_font_for_elements( $custom_css );
if ( ! empty( $custom_css ) ) {
wp_add_inline_style( 'artistas-styles', $custom_css );
}
}
function artistas_wp_title ( $title, $sep ) {
if ( ! function_exists( '_wp_render_title_tag' ) ) {
global $paged, $page;
if ( is_feed() ) {
return $title;
}
// Add the site name.
$title .= get_bloginfo( 'name' );
// Add the site description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) ) {
$title = "$title $sep $site_description";
}
// Add a page number if necessary.
if ( $paged >= 2 || $page >= 2 ) {
$title = "$title $sep " . sprintf( esc_html__( 'Page %s', 'artistas' ), max( $paged, $page ) );
}
}
return $title;
}
function artistas_nav_menu_item_title ( $title, $item, $args, $depth ) {
foreach ( $item->classes as $class ) {
if ( $class === 'menu-item-has-children' ) {
$title .= ' ';
return $title;
}
}
return $title;
}
function artistas_overwrite_theme_options () {
global $artistas_theme_options;
foreach ( $artistas_theme_options as $key => $value ) {
if ( isset( $_GET[ $key ] ) ) {
$artistas_theme_options[ $key ] = $_GET[ $key ];
}
}
}
function artistas_favicon () {
global $artistas_theme_options;
if ( ! function_exists( 'has_site_icon' ) || ! has_site_icon() ) {
if ( ! empty( $artistas_theme_options['favicon'] ) && ! empty( $artistas_theme_options['favicon']['id'] ) ) {
$favicon = wp_get_attachment_image_src( $artistas_theme_options['favicon']['id'], 'full' );
if ( ! empty( $favicon ) ) {
?>
,