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( 'artcela_featured', 715 , 9999, false );
add_image_size( 'artcela_related', 158,170,true );
add_image_size( 'artcela_featuredbox', 347,280,true );
add_image_size( 'artcela_widget', 270,230,true );
add_image_size( 'artcela_widget_255', 270,255,true );
add_image_size( 'artcela_postnav', 58,58,true );
// Editor style
add_editor_style('css/style.css');
// Post Formats
add_theme_support( 'post-formats', array( 'link', 'gallery', 'video' , 'audio', 'quote') );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary', 'artcela' ),
'mobile' => esc_html__( 'Mobile', 'artcela' ),
) );
/*
* 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( 'artcela_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
}
endif;
add_action( 'after_setup_theme', 'artcela_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 artcela_content_width() {
$GLOBALS['content_width'] = apply_filters( 'artcela_content_width', 640 );
}
add_action( 'after_setup_theme', 'artcela_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function artcela_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'artcela' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Sidebar widget area', 'artcela' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar(array(
'name' => esc_html__( 'Sidebar 2', 'artcela' ),
'id' => 'sidebar-2',
'description' => esc_html__( 'Secondary Sidebar widget area', 'artcela' ),
'before_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => esc_html__( 'Footer 1', 'artcela' ),
'id' => 'footer-1',
'description' => esc_html__( 'Footer widget area.', 'artcela' ),
'before_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => esc_html__( 'Footer 2', 'artcela' ),
'id' => 'footer-2',
'description' => esc_html__( 'Footer 2 widget area.', 'artcela' ),
'before_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => esc_html__( 'Footer 3', 'artcela' ),
'id' => 'footer-3',
'description' => esc_html__( 'Footer 3 widget area.', 'artcela' ),
'before_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => esc_html__( 'Footer Large', 'artcela' ),
'id' => 'footer-large',
'description' => esc_html__( 'Footer Full width widget area.', 'artcela' ),
'before_widget' => '',
'before_title' => '',
));
if ( class_exists( 'WooCommerce' ) ) {
register_sidebar(array(
'name' => esc_html__( 'Shop Sidebar', 'artcela' ),
'id' => 'shop-large',
'description' => esc_html__( 'Shop Sidebar widget area.', 'artcela' ),
'before_widget' => '',
'before_title' => '',
));
} else {}
}
add_action( 'widgets_init', 'artcela_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function artcela_scripts() {
wp_enqueue_style( 'artcela-style', get_stylesheet_uri() );
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css',false,'1.1','all');
wp_enqueue_style( 'artcela-stylecss', get_template_directory_uri() . '/css/style.css',false,'1.1','all');
wp_enqueue_style( 'fontawsome', get_template_directory_uri() . '/css/font-awesome.min.css',false,'1.1','all');
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.js', array('jquery'), '1.0', true );
wp_enqueue_script( 'artcela-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
wp_enqueue_script( 'artcela-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
wp_enqueue_script( 'modernizr', get_template_directory_uri() . '/js/modernizr.custom.js', array('jquery'), true );
wp_enqueue_script( 'classie', get_template_directory_uri() . '/js/classie.js', array('jquery'), true );
// Scroll Animate
wp_enqueue_style( 'artcela-animate', get_template_directory_uri() . '/css/animate.css',false,'1.1','all');
wp_enqueue_script( 'artcela-viewportchecker', get_template_directory_uri() . '/js/viewportchecker.js', array('jquery'), true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'artcela_scripts' );
add_action( 'wp_enqueue_scripts', 'artcela_footerscripts_script' );
function artcela_footerscripts_script() {
wp_enqueue_script( 'artcela-footerscripts', get_template_directory_uri() . '/js/footerscripts.js', array('jquery'), '1.0',true );
}
/**
* 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';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
// Numeric Post nav
$path_includes = get_template_directory() . '/inc/';
require_once ($path_includes . 'numeric-nav.php');
// Add span to CATEGORIES count widget
add_filter('wp_list_categories', 'artcela_span_cat_count');
function artcela_span_cat_count($links) {
$links = str_replace(' (', ' (', $links);
$links = str_replace(')', ')', $links);
return $links;
}
// Load Widgets
include get_template_directory() . "/inc/widgets/about-widget.php"; // About us
include get_template_directory() . "/inc/widgets/widget-popular-posts.php"; // Popular Posts
include get_template_directory() . "/inc/widgets/widget-random-posts.php"; // Random Posts
include get_template_directory() . "/inc/widgets/widget-select-post.php"; // single Posts
include get_template_directory() . "/inc/widgets/recent-post.php"; // Recent Posts
include get_template_directory() . "/inc/widgets/widget-select-featured-post.php"; // featured Posts
// Load Social share
include get_template_directory() . "/inc/themesmaestro-social-share.php"; //
// limit content
function artcela_my_excerpt_length($length) {
return 900;
}
add_filter('excerpt_length', 'artcela_my_excerpt_length');
add_action('the_excerpt','artcela_limit_the_content');
function artcela_limit_the_content($content){
if( get_theme_mod( 'blog_content', __( 'excerpt', 'artcela' ) ) == 'excerpt'){
$word_limit = esc_html(get_theme_mod('excerpt-count'));
$words = explode(' ', $content);
if (!is_single() && !is_page()){
return implode(' ', array_slice($words, 0, $word_limit))."...";
}
} else {
return $content;
}
}
add_filter( 'the_content', 'artcela_my_aside', 9 );
function artcela_my_aside( $content ) {
if ( has_post_format( 'aside' ) && !is_singular() )
$content .= ' ∞';
return $content;
}
//limit widget excerpt
function artcela_excerpt($limit) {
$excerpt = explode(' ', get_the_excerpt(), $limit);
if (count($excerpt)>=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).'...';
} else {
$excerpt = implode(" ",$excerpt);
}
$excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt);
return $excerpt;
}
// Custom comments
function Artcela_comment($comment, $args, $depth) {
if ( 'div' === $args['style'] ) {
$tag = 'div';
$add_below = 'comment';
} else {
$tag = 'li';
$add_below = 'div-comment';
}
?>
< id="comment-">
'Shortcodes Ultimate Plugin', // The plugin name.
'slug' => 'shortcodes-ultimate', // The plugin slug (typically the folder name).
'source' => '', // The plugin source.
'required' => false, // If false, the plugin is only 'recommended' instead of required.
'external_url' => 'https://wordpress.org/plugins/shortcodes-ultimate/', // If set, overrides default API URL and points to an external URL.
),
array(
'name' => 'MailChimp Plugin', // The plugin name.
'slug' => 'mailchimp-for-wp', // The plugin slug (typically the folder name).
'source' => '', // The plugin source.
'required' => false, // If false, the plugin is only 'recommended' instead of required.
'external_url' => 'https://wordpress.org/plugins/mailchimp-for-wp/', // If set, overrides default API URL and points to an external URL.
),
array(
'name' => 'Contact Form 7', // The plugin name.
'slug' => 'contact-form-7', // The plugin slug (typically the folder name).
'source' => '', // The plugin source.
'required' => false, // If false, the plugin is only 'recommended' instead of required.
'external_url' => 'https://wordpress.org/plugins/contact-form-7/', // If set, overrides default API URL and points to an external URL.
),
array(
'name' => 'Instagram Slider Widget', // The plugin name.
'slug' => 'instagram-slider-widget', // The plugin slug (typically the folder name).
'source' => '', // The plugin source.
'required' => false, // If false, the plugin is only 'recommended' instead of required.
'external_url' => 'https://wordpress.org/plugins/instagram-slider-widget/', // If set, overrides default API URL and points to an external URL.
),
array(
'name' => 'Kirki', // The plugin name.
'slug' => 'kirki', // The plugin slug (typically the folder name).
'source' => '',
// The plugin source.
'required' => false, // If false, the plugin is only 'recommended' instead of required.
'external_url' => 'https://wordpress.org/plugins/kirki/', // If set, overrides default API URL and points to an external URL.
),
array(
'name' => 'One Click Demo Import', // The plugin name.
'slug' => 'one-click-demo-import', // The plugin slug (typically the folder name).
'source' => '',
// The plugin source.
'required' => false, // If false, the plugin is only 'recommended' instead of required.
'external_url' => 'https://wordpress.org/plugins/one-click-demo-import/', // If set, overrides default API URL and points to an external URL.
),
array(
'name' => 'Meta Box', // The plugin name.
'slug' => 'meta-box', // The plugin slug (typically the folder name).
'source' => '', // The plugin source.
'required' => false, // If false, the plugin is only 'recommended' instead of required.
'external_url' => 'https://wordpress.org/plugins/meta-box/', // If set, overrides default API URL and points to an external URL.
),
);
tgmpa( $plugins);
}
// wp_kses() Allowed HTML use in data validation
function artcela_allow_html() {
$return = array(
'iframe' => array(
'src' => array(),
'height' => array(),
'width' => array()
),
'object' => array(
'height' => array(),
'width' => array()
),
'param' => array(
'name' => array(),
'value' => array()
),
'embed' => array(
'src' => array(),
'type' => array(),
'allowfullscreen' => array(),
'allowscriptaccess' => array(),
'height' => array(),
'width' => array()
),
'section' => array(
'class' => array()
),
'a' => array(
'href' => array(),
'title' => array(),
'target' => array(),
'title' => array(),
'class' => array()
),
'div' => array(
'class' => array(),
'id' => array(),
),
'ul' => array(
'class' => array(),
'id' => array()
),
'ol' => array(
'class' => array(),
'id' => array()
),
'li' => array(
'class' => array(),
'id' => array()
),
'br' => array(),
'h1' => array(
'class' => array(),
'id' => array()
),
'h2' => array(
'class' => array(),
'id' => array()
),
'h3' => array(
'class' => array(),
'id' => array()
),
'h4' => array(
'class' => array(),
'id' => array()
),
'h5' => array(
'class' => array(),
'id' => array()
),
'h6' => array(
'class' => array(),
'id' => array()
),
'img' => array(
'alt' => array(),
'src' => array(),
'title' => array()
),
'em' => array(),
'b' => array(),
'i' => array(
'class' => array(),
'id' => array()
),
'strong' => array(
'class' => array(),
'id' => array()
),
'span' => array(
'class' => array(),
'id' => array(),
'style' => array()
),
'p' => array(
'class' => array(),
'id' => array(),
'style' => array()
),
);
return $return;
}
add_action( 'admin_menu', 'artcela_remove_redux_menu',12 );
function artcela_remove_redux_menu() {
remove_submenu_page('tools.php','redux-about');
}
// Check if meta-box plugin if active
if (function_exists('rwmb_meta')) {}
else{
function rwmb_meta(){
return '';
}
}
// Meta boxes
add_filter( 'rwmb_meta_boxes', 'artcela_register_meta_boxes' );
function artcela_register_meta_boxes( $meta_boxes ) {
$prefix = 'rw_';
// Video Post
$meta_boxes[] = array(
'id' => 'video',// show olny on video post format
'title' => esc_html__( 'Featured Video', 'artcela' ),
'pages' => array( 'post', 'page' ),
'context' => 'normal',
'priority' => 'high',
'autosave' => true,
// List of meta fields
'fields' => array(
array(
'name' => esc_html__( 'Add Video link here', 'artcela' ),
'id' => $prefix . 'video',
'type' => 'oembed',
),
array(
'name' => esc_html__( 'Add Youtube Video id here', 'artcela' ),
'id' => $prefix . 'videoyoutube',
'type' => 'text',
),
),
);
// Audio post
$meta_boxes[] = array(
'id' => 'audio',// show olny on video post format
'title' => esc_html__( 'Featured audio', 'artcela' ),
'pages' => array( 'post', 'page' ),
'context' => 'normal',
'priority' => 'high',
'autosave' => true,
// List of meta fields
'fields' => array(
array(
'name' => esc_html__( 'Add Audio link here', 'artcela' ),
'id' => $prefix . 'audio',
'type' => 'oembed',
),
),
);
// Link post
$meta_boxes[] = array(
'id' => 'link',// show olny on link post format
'title' => esc_html__( 'Link', 'artcela' ),
'pages' => array( 'post'),
'context' => 'normal',
'priority' => 'high',
'autosave' => true,
'fields' => array(
array(
'name' => esc_html__( 'URL', 'artcela' ),
'id' => $prefix . 'url',
'type' => 'text',
),
)
);
// all post types
$meta_boxes[] = array(
'title' => esc_html__( 'Layout Options', 'artcela' ),
'pages' => array( 'post', 'page' ),
'fields' => array(
array(
'id' => $prefix .'layout',
'name' => esc_html__( 'Layout', 'artcela' ),
'type' => 'image_select',
'options' => array(
'default' => get_template_directory_uri() . '/assets/images/defa.png',
'onecol' => get_template_directory_uri() . '/assets/images/1c.png',
'left' => get_template_directory_uri() . '/assets/images/2cl.png',
'right' => get_template_directory_uri() . '/assets/images/2cr.png',
'leftright' => get_template_directory_uri() . '/assets/images/3cm.png',
'dualleft' => get_template_directory_uri() . '/assets/images/3cl.png',
'dualright' => get_template_directory_uri() . '/assets/images/3cr.png',
),
),
array(
'name' => esc_html__( 'Slider Shortcode', 'artcela' ),
'id' => $prefix . 'slider',
'type' => 'text',
),
),
);
return $meta_boxes;
}
add_action('admin_head', 'artcela_custom_image_removeredux');
function artcela_custom_image_removeredux() {
echo '';
}
function artcela_removeDemoModeLink() {
if ( class_exists('ReduxFrameworkPlugin') ) {
remove_filter( 'plugin_row_meta', array( ReduxFrameworkPlugin::get_instance(), 'plugin_metalinks'), null, 2 );
}
if ( class_exists('ReduxFrameworkPlugin') ) {
remove_action('admin_notices', array( ReduxFrameworkPlugin::get_instance(), 'admin_notices' ) );
}
}
add_action('init', 'artcela_removeDemoModeLink');
// Custom Style
function artcela_stylesheets() {
wp_enqueue_style( 'artcela-woocommerce', get_template_directory_uri() . '/css/woocommerce.css',false,'1.1','all');
wp_enqueue_style( 'artcela-responsive', get_template_directory_uri() . '/css/responsive.css',false,'1.1','all');
wp_enqueue_style( 'artcela-customstyle', get_template_directory_uri() . '/css/customcss.css',false,'1.1','all');
Global $Artcela;
include get_template_directory() . "/css/customcss.php"; // about us
if(!isset($optimageselectslider)){ $optimageselectslider = ''; }
if(!isset($is_page_style)){ $is_page_style = ''; }
if(!isset($is_404_style)){ $is_404_style = ''; }
if(!isset($layout_style)){ $layout_style = ''; }
if(!isset($layout_style_page)){ $layout_style_page = ''; }
if(!isset($layout_style_archive)){ $layout_style_archive = ''; }
if(!isset($layout_style_shop)){ $layout_style_shop = ''; }
if(!isset($layout_style_shop_single)){ $layout_style_shop_single = ''; }
if(!isset($layout_style_single)){ $layout_style_single = ''; }
if(!isset($header_icon_color_social)){ $header_icon_color_social = ''; }
$css ="
::-webkit-scrollbar-thumb,.widget_mc4wp_form_widget input[type=\"submit\"] , .tagcloud a,.woocommerce nav.woocommerce-pagination ul li span.current,.woocommerce div.product .entry-summary div[itemprop='description']:before,.woocommerce #respond input#submit:hover,.woocommerce a.button:hover,.woocommerce button.button:hover,.woocommerce input.button:hover,.woocommerce #respond input#submit.alt:hover,.woocommerce a.button.alt:hover,.woocommerce button.button.alt:hover,.woocommerce input.button.alt:hover,.woocommerce span.onsale,.woocommerce div.product .entry-summary div[itemprop='description'] blockquote .author span:after,.woocommerce div.product .woocommerce-tabs #tab-description blockquote .author span:after,.header-cart-count{
background-color:". get_theme_mod( 'color_demo_preset','#3d9fff') .";
}
.woocommerce div.product p.price ins,.woocommerce div.product span.price ins,.woocommerce div.product p.price,.woocommerce div.product span.price,.woocommerce div.product .entry-summary div[itemprop='description'] blockquote:before,.woocommerce div.product .woocommerce-tabs #tab-description blockquote:before,.woocommerce div.product .entry-summary div[itemprop='description'] blockquote cite,.woocommerce div.product .entry-summary div[itemprop='description'] blockquote .author,.woocommerce div.product .woocommerce-tabs #tab-description blockquote cite,.woocommerce div.product .woocommerce-tabs #tab-description blockquote .author,.woocommerce div.product .product_meta > span a:hover,.woocommerce div.product .woocommerce-tabs ul.tabs li.active,.woocommerce ul.cart_list li .amount,.woocommerce ul.product_list_widget li .amount,.woocommerce table.shop_table td.product-name a:hover,.woocommerce table.shop_table td.product-price span,.woocommerce table.shop_table td.product-subtotal span,.woocommerce-cart .cart-collaterals .cart_totals table td .amount ,.woocommerce .woocommerce-info:before,.woocommerce form.checkout table.shop_table .order-total .amount,.woocommerce ul.products li.product .price ins,.woocommerce ul.products li.product .price,.tags-links a , .writecomment a:hover , .cat-item a , .site-main .entry-content blockquote p span , .post-navigation .post-nav-text-title:hover , .post-navigation .prev-next a:hover , .widget .page_item a , .artcela-menu ul a:hover , .menu-icons li i:hover,.menu-icons li a:hover,.site-content .content-area .cat-links a, .entryfootercats:after , .paging-navigation li , .paging-navigation a ,.paging-navigation .current , .widget_meta a , .slider-post-text .cat-links a , .widget_recent_comments a , .widget_archive li a , .widget_recent_entries li a,.widget .widin a:hover{
color:". get_theme_mod( 'color_demo_preset','#3d9fff') .";
}
.woocommerce-meta-custom,.woocommerce .woocommerce-error,.woocommerce .woocommerce-info,.woocommerce .woocommerce-message,.woocommerce nav.woocommerce-pagination ul li span.current,.f-post-title , .slider-post-text , .widget_meta li , .widget_nav_menu li , .widget_recent_entries li , .widget_archive li , .widget_recent_comments li , .cat-item , .widget .page_item , .site-main .entry-content blockquote , .second-sidebar>.widget, .widget-area>.widget ,.entry-header {
border-color:". get_theme_mod( 'color_demo_preset','#3d9fff') .";
}
.logopositionheader{
height: auto;
float:". $Artcela['opt-logo-position'] .";
margin: 0 auto !important;
}
.primary-button{
background-color:". $Artcela ['opt-readmorebuttoncolor-color-background']['regular']."; }
.primary-button:hover{
background-color:". $Artcela ['opt-readmorebuttoncolor-color-background']['hover']."; }
.primary-button:hover a{
color:". $Artcela ['opt-readmorebuttoncolor-color']['hover']."; }
.container{ max-width:". $Artcela ['control-width-body'].";
margin: 0 auto;
width:100%;
padding: 0;}
.featured-posts .container{width:100%;}
{$optimageselectslider}
{$is_page_style}
{$is_404_style}
{$layout_style}
{$layout_style_page}
{$layout_style_archive}
{$layout_style_shop}
{$layout_style_shop_single}
{$layout_style_single}
{$header_icon_color_social}
";
wp_add_inline_style( 'artcela-customstyle', $css );
}
add_action( 'wp_enqueue_scripts', 'artcela_stylesheets',999 );
/**
* Register custom fonts.
*/
function artcela_fonts_url() {
$fonts_url = '';
$fonts = array();
$subsets = 'latin,latin-ext';
/*
* Translators: If there are characters in your language that are not supported
* by Playfair Display, translate this to 'off'. Do not translate into your own language.
*/
if ( 'off' !== _x( 'on', 'Playfair Display font: on or off', 'artcela' ) ) {
$fonts[] = 'Playfair Display:100,200,300,400,700,900';
}
if ( 'off' !== _x( 'on', 'Montserrat font: on or off', 'artcela' ) ) {
$fonts[] = 'Montserrat:100,200,300,400,700,900';
}
if ( 'off' !== _x( 'on', 'Lato font: on or off', 'artcela' ) ) {
$fonts[] = 'Lato:100,200,300,400,700,900';
}
if ( $fonts ) {
$fonts_url = add_query_arg( array(
'family' => urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
), 'https://fonts.googleapis.com/css' );
}
return esc_url_raw( $fonts_url );
}
/**
* Enqueue fonts styles.
*/
function artcela_fonts() {
// Add custom fonts, used in the main stylesheet.
wp_enqueue_style( 'artcela-fonts', artcela_fonts_url(), array(), null );
}
add_action( 'wp_enqueue_scripts', 'artcela_fonts' );
/**
* Custom function for the callback validation referenced above
**/
if (!function_exists('artcela_custom_validate_callback_function')):
function artcela_custom_validate_callback_function($field, $value, $existing_value) {
$error = false;
$value = sanitize_text_field($value);
$return['value'] = $value;
if ($error == true) {
$return['error'] = $field;
}
return $return;
}
endif;
// Redux global function
if (!function_exists('artcela_get_options')) {
function artcela_get_options($var = '', $sub = '')
{
global $Artcela;
if ($sub) {
if (!empty($Artcela[$var][$sub])) {
return $Artcela[$var][$sub];
} else {
return '';
}
}
else {
if (!empty($Artcela[$var])) {
return $Artcela[$var];
} else {
return '';
}
}
}
}
//back to top button
//add_action( 'wp_footer', 'artcela_back_to_top' );
function artcela_back_to_top() {
if ( true == get_theme_mod( 'backtotop_setting_toggle', true ) ){
?>
' />
is_search) {
$query->set('post_type', 'post');
}
return $query;
}
add_filter('pre_get_posts','artcela_SearchFilter');
// Include Theme Options Extensions
if ( class_exists('ReduxFrameworkPlugin') && function_exists( 'themesmaestro_core' ) ) {
if(!function_exists('artcela_register_custom_extension_loader')) {
function artcela_register_custom_extension_loader($ReduxFramework) {
$path = WP_PLUGIN_DIR.'/themesmaestro-core/extensions/';
$folders = scandir( $path, 1 );
foreach ( $folders as $folder ) {
if ( $folder === '.' or $folder === '..' or ! is_dir( $path . $folder ) ) {
continue;
}
$extension_class = 'ReduxFramework_Extension_' . $folder;
if ( ! class_exists( $extension_class ) ) {
// In case you wanted override your override, hah.
$class_file = $path . $folder . '/extension_' . $folder . '.php';
$class_file = apply_filters( 'redux/extension/' . $ReduxFramework->args['opt_name'] . '/' . $folder, $class_file );
if ( $class_file ) {
require_once( $class_file );
}
}
if ( ! isset( $ReduxFramework->extensions[ $folder ] ) ) {
$ReduxFramework->extensions[ $folder ] = new $extension_class( $ReduxFramework );
}
}
}
// Modify {$redux_opt_name} to match your opt_name
add_action("redux/extensions/Artcela/before", 'artcela_register_custom_extension_loader', 0);
}
}
// woocommerce
if ( class_exists( 'WooCommerce' ) ) {
function artcela_woocommerce_cart_header(){
ob_start();
global $woocommerce;
$viewing_cart = __('View your shopping cart', 'artcela');
$start_shopping = __('Start shopping', 'artcela');
$cart_url = $woocommerce->cart->get_cart_url();
$shop_page_url = get_permalink( wc_get_page_id( 'shop' ) );
$cart_contents_count = $woocommerce->cart->cart_contents_count;
/* translators: %d: item count */
$cart_contents = sprintf(_n('%d item', '%d items', $cart_contents_count, 'artcela'), $cart_contents_count);
$cart_total = $woocommerce->cart->get_cart_total();
// Uncomment the line below to hide nav menu cart item when there are no items in the cart
// if ( $cart_contents_count > 0 ) {
if ($cart_contents_count == 0) {
$menu_item = '
';
} else {
$menu_item = '
';
}
$social = ob_get_clean();
return $menu_item . $social;
}
add_filter( 'woocommerce_add_to_cart_fragments', 'artcela_cart_count_fragments', 10, 1 );
function artcela_cart_count_fragments( $fragments ) {
$fragments['span.header-cart-count'] = '';
return $fragments;
}
add_action( 'after_setup_theme', 'artcela_woocommerce_support' );
function artcela_woocommerce_support() {
add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'artcela_wc_setup' );
function artcela_wc_setup() {
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
}
}
/**
* Products per page.
*
* @return integer number of products.
*/
if ( class_exists('ReduxFrameworkPlugin') && function_exists( 'themesmaestro_core' ) ) {
function artcela_woocommerce_products_per_page() {
Global $Artcela;
return $Artcela['woocommerce-product-per-page'];
}
add_filter( 'loop_shop_per_page', 'artcela_woocommerce_products_per_page' );
}
/**
* Default loop columns on product archives.
*
* @return integer products per row.
*/
if ( class_exists('ReduxFrameworkPlugin') && function_exists( 'themesmaestro_core' ) ) {
function artcela_woocommerce_loop_columns() {
Global $Artcela;
return $Artcela['woocommerce-layout-grid-col'];
}
add_filter( 'loop_shop_columns', 'artcela_woocommerce_loop_columns' ); }
/**
* Related Products Args.
*
* @param array $args related products args.
* @return array $args related products args.
*/
if ( class_exists('ReduxFrameworkPlugin') && function_exists( 'themesmaestro_core' ) ) {
function artcela_woocommerce_related_products_args( $args ) {
Global $Artcela;
$defaults = array(
'posts_per_page' => $Artcela['woocommerce-related-product-per-page'],
'columns' => 4,
);
$args = wp_parse_args( $defaults, $args );
return $args;
}
add_filter( 'woocommerce_output_related_products_args', 'artcela_woocommerce_related_products_args' ); }
if ( ! function_exists( 'artcela_woocommerce_product_columns_wrapper' ) ) {
/**
* Product columns wrapper.
*
* @return void
*/
function artcela_woocommerce_product_columns_wrapper() {
$columns = artcela_woocommerce_loop_columns();
echo '';
}
}
add_action( 'woocommerce_before_shop_loop', 'artcela_woocommerce_product_columns_wrapper', 40 );
if ( ! function_exists( 'artcela_woocommerce_product_columns_wrapper_close' ) ) {
/**
* Product columns wrapper close.
*
* @return void
*/
function artcela_woocommerce_product_columns_wrapper_close() {
echo '
';
}
}
add_action( 'woocommerce_after_shop_loop', 'artcela_woocommerce_product_columns_wrapper_close', 40 );
/**
* Remove default WooCommerce wrapper.
*/
remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10 );
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10 );
if ( ! function_exists( 'artcela_woocommerce_wrapper_before' ) ) {
/**
* Before Content.
*
* Wraps all WooCommerce content in wrappers which match the theme markup.
*
* @return void
*/
function artcela_woocommerce_wrapper_before() {
?>
true,
// Make specific theme colors available in the editor.
'colors' => array(
'#ffffff',
'#000000',
'#cccccc',
),
) );
/**
* Enqueue editor styles for Gutenberg
*/
function artcela_editor_styles() {
wp_enqueue_style( 'artcela-editor-style', get_template_directory_uri() . '/css/gutenberg.css' );
wp_enqueue_style( 'artcela-fonts', artcela_fonts_url(), array(), null );
}
add_action( 'enqueue_block_editor_assets', 'artcela_editor_styles' );
// change wp default customizer section name
function customize_register_init( $wp_customize ){
//$wp_customize->get_section('title_tagline')->title = __( 'Logo & Favicon','artcela' );
//$wp_customize->remove_section( 'title_tagline' );
//$wp_customize->get_section('title_tagline')->priority = 1;
$wp_customize->get_control('display_header_text')->label = esc_html__( 'Display Site Title and Tagline / Image Logo', 'artcela' );
}
add_action( 'customize_register', 'customize_register_init' );
// adding custom fonts to kirki
// https://tomiup.com/add-custom-fonts-to-kirki-customizer/
function tmu_custom_fonts( $standard_fonts ){
$my_custom_fonts = array();
$my_custom_fonts['kitten'] = array(
'label' => 'kitten',
'variants' => array('regular'),
'stack' => 'kitten, sans-serif',
);
$my_custom_fonts['font2'] = array(
'label' => 'Another Font',
'variants' => array('regular','italic','700','700italic'),
'stack' => 'anotherfont, sans-serif',
);
return array_merge_recursive( $my_custom_fonts, $standard_fonts );
}
add_filter( 'kirki/fonts/standard_fonts', 'tmu_custom_fonts', 20 );
// Include kirki options
include get_template_directory() . "/inc/kirki-options.php"; // About us
// One click demo import.
require wp_normalize_path( trailingslashit( get_template_directory() ) ) . 'inc/ocdi/one-click-demo-import-settings.php';
/**
* This function adds Custom styles to the WordPress Customizer
*/
function my_customizer_styles() { ?>