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' ); set_post_thumbnail_size( 150, 150, true ); add_image_size( 'publishable-mag-related', 200, 125, true ); //related // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Primary', 'publishable-mag' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'gallery', 'caption', ) ); if ( publishable_lite_is_wc_active() ) { add_theme_support( 'woocommerce' ); } // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'publishable_lite_custom_background_args', array( 'default-color' => '#eee', 'default-image' => '', ) ) ); } endif; add_action( 'after_setup_theme', 'publishable_lite_setup' ); function publishable_lite_content_width() { $GLOBALS['content_width'] = apply_filters( 'publishable_lite_content_width', 678 ); } add_action( 'after_setup_theme', 'publishable_lite_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function publishable_lite_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'publishable-mag' ), 'id' => 'sidebar', 'description' => '', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); // Header Ad sidebar register_sidebar(array( 'name' => __('Header Ad', 'publishable-mag'), 'description' => __( '728x90 Ad Area', 'publishable-mag' ), 'id' => 'widget-header', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); // First Footer register_sidebar( array( 'name' => __( 'Footer 1', 'publishable-mag' ), 'description' => __( 'First footer column', 'publishable-mag' ), 'id' => 'footer-first', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); // Second Footer register_sidebar( array( 'name' => __( 'Footer 2', 'publishable-mag' ), 'description' => __( 'Second footer column', 'publishable-mag' ), 'id' => 'footer-second', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); // Third Footer register_sidebar( array( 'name' => __( 'Footer 3', 'publishable-mag' ), 'description' => __( 'Third footer column', 'publishable-mag' ), 'id' => 'footer-third', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); if ( publishable_lite_is_wc_active() ) { // Register WooCommerce Shop and Single Product Sidebar register_sidebar( array( 'name' => __('Shop Page Sidebar', 'publishable-mag' ), 'description' => __( 'Appears on Shop main page and product archive pages.', 'publishable-mag' ), 'id' => 'shop-sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __('Single Product Sidebar', 'publishable-mag' ), 'description' => __( 'Appears on single product pages.', 'publishable-mag' ), 'id' => 'product-sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } } add_action( 'widgets_init', 'publishable_lite_widgets_init' ); function publishable_lite_custom_sidebar() { // Default sidebar. $sidebar = 'sidebar'; // Woocommerce. if ( publishable_lite_is_wc_active() ) { if ( is_shop() || is_product_category() ) { $sidebar = 'shop-sidebar'; } if ( is_product() ) { $sidebar = 'product-sidebar'; } } return $sidebar; } /** * Enqueue scripts and styles. */ function publishable_lite_scripts() { wp_enqueue_style( 'publishable-mag-style', get_stylesheet_uri() ); $handle = 'publishable-mag-style'; // WooCommerce if ( publishable_lite_is_wc_active() ) { if ( is_woocommerce() || is_cart() || is_checkout() ) { wp_enqueue_style( 'woocommerce', get_template_directory_uri() . '/css/woocommerce2.css' ); $handle = 'woocommerce'; } } wp_enqueue_script( 'publishable-mag-customscripts', get_template_directory_uri() . '/js/customscripts.js',array('jquery'),'',true); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } $publishable_lite_color_scheme = get_theme_mod('publishable_lite_color_scheme', '#c69c6d'); $publishable_lite_color_scheme2 = get_theme_mod('publishable_lite_color_scheme2', '#1b1b1b'); $publishable_lite_layout = get_theme_mod('publishable_lite_layout', 'cslayout'); $header_image = get_header_image(); $custom_css = " #site-header { background-image: url('$header_image'); } #tabber .inside li .meta b,footer .widget li a:hover,.fn a,.reply a,#tabber .inside li div.info .entry-title a:hover, #navigation ul ul a:hover,.single_post a, a:hover, .sidebar.c-4-12 .textwidget a, #site-footer .textwidget a, #commentform a, #tabber .inside li a, .copyrights a:hover, a, .sidebar.c-4-12 a:hover, .top a:hover, footer .tagcloud a:hover { color: $publishable_lite_color_scheme; } span.sticky-post, .nav-previous a:hover, .nav-next a:hover, #commentform input#submit, #searchform input[type='submit'], .home_menu_item, .primary-navigation, .currenttext, .pagination a:hover, .readMore a, .mts-subscribe input[type='submit'], .pagination .current, .woocommerce nav.woocommerce-pagination ul li a:focus, .woocommerce nav.woocommerce-pagination ul li a:hover, .woocommerce nav.woocommerce-pagination ul li span.current, .woocommerce-product-search input[type=\"submit\"], .woocommerce a.button, .woocommerce-page a.button, .woocommerce button.button, .woocommerce-page button.button, .woocommerce input.button, .woocommerce-page input.button, .woocommerce #respond input#submit, .woocommerce-page #respond input#submit, .woocommerce #content input.button, .woocommerce-page #content input.button { background-color: $publishable_lite_color_scheme; } .woocommerce nav.woocommerce-pagination ul li span.current, .woocommerce-page nav.woocommerce-pagination ul li span.current, .woocommerce #content nav.woocommerce-pagination ul li span.current, .woocommerce-page #content nav.woocommerce-pagination ul li span.current, .woocommerce nav.woocommerce-pagination ul li a:hover, .woocommerce-page nav.woocommerce-pagination ul li a:hover, .woocommerce #content nav.woocommerce-pagination ul li a:hover, .woocommerce-page #content nav.woocommerce-pagination ul li a:hover, .woocommerce nav.woocommerce-pagination ul li a:focus, .woocommerce-page nav.woocommerce-pagination ul li a:focus, .woocommerce #content nav.woocommerce-pagination ul li a:focus, .woocommerce-page #content nav.woocommerce-pagination ul li a:focus, .pagination .current, .tagcloud a { border-color: $publishable_lite_color_scheme; } .corner { border-color: transparent transparent $publishable_lite_color_scheme transparent;} .primary-navigation, footer, .readMore a:hover, #commentform input#submit:hover, .featured-thumbnail .latestPost-review-wrapper { background-color: $publishable_lite_color_scheme2; } "; if(!empty($publishable_lite_layout) && $publishable_lite_layout == "sclayout") { $custom_css .= ".article { float: right; } .sidebar.c-4-12 { float: left; }"; } wp_add_inline_style( $handle, $custom_css ); } add_action( 'wp_enqueue_scripts', 'publishable_lite_scripts' ); /** * 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'; /** * Add the Social buttons Widget. */ include_once( "functions/widget-social.php" ); /** * Copyrights */ if ( ! function_exists( 'publishable_lite_copyrights_credit' ) ) { function publishable_lite_copyrights_credit() { global $mts_options ?>
  • id="li-comment-">
    comment_author_email, 70 ); ?>
    comment_approved == '0') : ?>
  • =$limit) { array_pop($excerpt); $excerpt = implode(" ",$excerpt); } else { $excerpt = implode(" ",$excerpt); } $excerpt = preg_replace('`[[^]]*]`','',$excerpt); return $excerpt; } /** * Shorthand function to check for more tag in post. * * @return bool|int */ function publishable_lite_post_has_moretag() { return strpos( get_the_content(), '' ); } if ( ! function_exists( 'publishable_lite_readmore' ) ) { /** * Display a "read more" link. */ function publishable_lite_readmore() { ?>
    '.esc_html(sprintf( __( "Home", 'publishable-mag' ))); echo ''; if (is_single()) { $categories = get_the_category(); if ( $categories ) { $level = 0; $hierarchy_arr = array(); foreach ( $categories as $cat ) { $anc = get_ancestors( $cat->term_id, 'category' ); $count_anc = count( $anc ); if ( 0 < $count_anc && $level < $count_anc ) { $level = $count_anc; $hierarchy_arr = array_reverse( $anc ); array_push( $hierarchy_arr, $cat->term_id ); } } if ( empty( $hierarchy_arr ) ) { $category = $categories[0]; echo ''.esc_html( $category->name ).''; } else { foreach ( $hierarchy_arr as $cat_id ) { $category = get_term_by( 'id', $cat_id, 'category' ); echo ''.esc_html( $category->name ).''; } } } echo ""; the_title(); echo ""; } elseif (is_page()) { $parent_id = wp_get_post_parent_id( get_the_ID() ); if ( $parent_id ) { $breadcrumbs = array(); while ( $parent_id ) { $page = get_page( $parent_id ); $breadcrumbs[] = ''.esc_html( get_the_title($page->ID) ). ''; $parent_id = $page->post_parent; } $breadcrumbs = array_reverse( $breadcrumbs ); foreach ( $breadcrumbs as $crumb ) { echo $crumb; } } echo ""; the_title(); echo ""; } elseif (is_category()) { global $wp_query; $cat_obj = $wp_query->get_queried_object(); $this_cat_id = $cat_obj->term_id; $hierarchy_arr = get_ancestors( $this_cat_id, 'category' ); if ( $hierarchy_arr ) { $hierarchy_arr = array_reverse( $hierarchy_arr ); foreach ( $hierarchy_arr as $cat_id ) { $category = get_term_by( 'id', $cat_id, 'category' ); echo ''.esc_html( $category->name ).''; } } echo ""; single_cat_title(); echo ""; } elseif (is_author()) { echo ""; if(get_query_var('author_name')) : $curauth = get_user_by('slug', get_query_var('author_name')); else : $curauth = get_userdata(get_query_var('author')); endif; echo esc_html( $curauth->nickname ); echo ""; } elseif (is_search()) { echo ""; the_search_query(); echo ""; } elseif (is_tag()) { echo ""; single_tag_title(); echo ""; } } } /* * Google Fonts */ function publishable_lite_fonts_url() { $fonts_url = ''; /* Translators: If there are characters in your language that are not * supported by Monda, translate this to 'off'. Do not translate * into your own language. */ $monda = _x( 'on', 'Monda font: on or off', 'publishable-mag' ); if ( 'off' !== $monda ) { $font_families = array(); if ( 'off' !== $monda ) { $font_families[] = urldecode('Roboto:400,500,700,900'); } $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), //'subset' => urlencode( 'latin,latin-ext' ), ); $fonts_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' ); } return $fonts_url; } function publishable_lite_scripts_styles() { wp_enqueue_style( 'theme-slug-fonts', publishable_lite_fonts_url(), array(), null ); } add_action( 'wp_enqueue_scripts', 'publishable_lite_scripts_styles' ); /** * WP Mega Menu Plugin Support */ function publishable_lite_megamenu_parent_element( $selector ) { return '.primary-navigation .container'; } add_filter( 'wpmm_container_selector', 'publishable_lite_megamenu_parent_element' ); /** * Determines whether the WooCommerce plugin is active or not. * @return bool */ function publishable_lite_is_wc_active() { if ( is_multisite() ) { include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); return is_plugin_active( 'woocommerce/woocommerce.php' ); } else { return in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ); } } /** * WooCommerce */ if ( publishable_lite_is_wc_active() ) { if ( !function_exists( 'mts_loop_columns' )) { /** * Change number or products per row to 3 * * @return int */ function mts_loop_columns() { return 3; // 3 products per row } } add_filter( 'loop_shop_columns', 'mts_loop_columns' ); /** * Redefine woocommerce_output_related_products() */ function woocommerce_output_related_products() { $args = array( 'posts_per_page' => 3, 'columns' => 3, ); woocommerce_related_products($args); // Display 3 products in rows of 1 } global $pagenow; if ( is_admin() && isset( $_GET['activated'] ) && $pagenow == 'themes.php' ) { /** * Define WooCommerce image sizes. */ function publishable_lite_woocommerce_image_dimensions() { $catalog = array( 'width' => '210', // px 'height' => '155', // px 'crop' => 1 // true ); $single = array( 'width' => '326', // px 'height' => '444', // px 'crop' => 1 // true ); $thumbnail = array( 'width' => '74', // px 'height' => '74', // px 'crop' => 0 // false ); // Image sizes update_option( 'shop_catalog_image_size', $catalog ); // Product category thumbs update_option( 'shop_single_image_size', $single ); // Single product image update_option( 'shop_thumbnail_image_size', $thumbnail ); // Image gallery thumbs } add_action( 'init', 'publishable_lite_woocommerce_image_dimensions', 1 ); } /** * Change the number of product thumbnails to show per row to 4. * * @return int */ function publishable_lite_woocommerce_thumb_cols() { return 4; // .last class applied to every 4th thumbnail } add_filter( 'woocommerce_product_thumbnails_columns', 'publishable_lite_woocommerce_thumb_cols' ); /** * Ensure cart contents update when products are added to the cart via AJAX. * * @param $fragments * * @return mixed */ function publishable_lite_header_add_to_cart_fragment( $fragments ) { global $woocommerce; ob_start(); ?> cart->cart_contents_count, 'publishable-mag' ), $woocommerce->cart->cart_contents_count );?> - cart->get_cart_total(); ?>
    %s', __( 'Featured', 'publishable-mag' ) ); } ?>