bitwallet_setup
*/
function bitwallet_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on bitwallet, use a find and replace
* to change 'bitwallet' to the name of your theme in all the template files
*/
load_theme_textdomain( 'bitwallet', get_template_directory() . '/languages' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary menu', 'bitwallet' )
) );
// ADD THEME SUPPORT
// OTHER SUPPORT
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'title-tag' );
add_theme_support( 'custom-header' );
add_theme_support( 'post-thumbnails' );
add_theme_support( 'html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption',
) );
// Switch default core markup for search form, comment form, and comments to output valid HTML5.
// Enable support for Post Formats.
add_theme_support( 'custom-background', apply_filters( 'smartowl_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );// Set up the WP core custom background feature.
add_theme_support( 'custom-logo' );
}
add_action( 'after_setup_theme', 'bitwallet_setup' );
/* CUSTOM CUSTOMIZER */
include get_template_directory() . '/customizer/customizer.php';
/**
||-> Register widget areas.
*/
function bitwallet_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'bitwallet' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Main Theme Sidebar', 'bitwallet' ),
'before_widget' => '',
'before_title' => '
',
) );
}
add_action( 'widgets_init', 'bitwallet_widgets_init' );
/**
||-> Enqueue scripts and styles.
*/
function bitwallet_scripts() {
//STYLESHEETS
wp_enqueue_style( "font-awesome", get_template_directory_uri().'/css/font-awesome.min.css' );
wp_enqueue_style( "bitwallet-responsive", get_template_directory_uri().'/css/responsive.css' );
wp_enqueue_style( "bitwallet-media-screens", get_template_directory_uri().'/css/media-screens.css' );
wp_enqueue_style( "owl-carousel", get_template_directory_uri().'/css/owl.carousel.css' );
wp_enqueue_style( "animate", get_template_directory_uri().'/css/animate.css' );
wp_enqueue_style( "bitwallet-style", get_template_directory_uri().'/css/styles.css' );
wp_enqueue_style( 'bitwallet-mt-style', get_stylesheet_uri() );
wp_enqueue_style( "bitwallet-blogloops-style", get_template_directory_uri().'/css/styles-module-blogloops.css' );
wp_enqueue_style( "bitwallet-navigations-style", get_template_directory_uri().'/css/styles-module-navigations.css' );
wp_enqueue_style( "bitwallet-header-style", get_template_directory_uri().'/css/styles-headers.css' );
wp_enqueue_style( "bitwallet-footer-style", get_template_directory_uri().'/css/styles-footer.css' );
wp_enqueue_style( "loaders", get_template_directory_uri().'/css/loaders.css' );
wp_enqueue_style( "simple-line-icons", get_template_directory_uri().'/css/simple-line-icons.css' );
wp_enqueue_style( "js_composer", get_template_directory_uri().'/css/js_composer.css' );
wp_enqueue_style( "montserrat", 'https://fonts.googleapis.com/css?family=Montserrat:400,400i,600,700,800&subset=latin-ext' );
//SCRIPTS
wp_enqueue_script( 'modernizr-custom', get_template_directory_uri() . '/js/modernizr.custom.js', array('jquery'), '2.6.2', true );
wp_enqueue_script( 'classie', get_template_directory_uri() . '/js/classie.js', array('jquery'), '1.0.0', true );
wp_enqueue_script( 'jquery-form', get_template_directory_uri() . '/js/jquery.form.js', array('jquery'), '3.51.0', true );
wp_enqueue_script( 'jquery-ketchup', get_template_directory_uri() . '/js/jquery.ketchup.js', array('jquery'), '0.3.1', true );
wp_enqueue_script( 'jquery-validation', get_template_directory_uri() . '/js/jquery.validation.js', array('jquery'), '1.13.1', true );
wp_enqueue_script( 'jquery-sticky', get_template_directory_uri() . '/js/jquery.sticky.js', array('jquery'), '1.0.0', true );
wp_enqueue_script( 'uisearch', get_template_directory_uri() . '/js/uisearch.js', array('jquery'), '1.0.0', true );
wp_enqueue_script( 'jquery-parallax', get_template_directory_uri() . '/js/jquery.parallax.js', array('jquery'), '1.1.3', true );
wp_enqueue_script( 'jquery.appear', get_template_directory_uri() . '/js/jquery.appear.js', array('jquery'), '1.0.0', true );
wp_enqueue_script( 'jquery.countTo', get_template_directory_uri() . '/js/jquery.countTo.js', array('jquery'), '1.0.0', true );
wp_enqueue_script( 'owl-carousel', get_template_directory_uri() . '/js/owl.carousel.js', array('jquery'), '1.0.0', true );
wp_enqueue_script( 'modernizr-viewport', get_template_directory_uri() . '/js/modernizr.viewport.js', array('jquery'), '2.6.2', true );
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '3.3.1', true );
wp_enqueue_script( 'animate', get_template_directory_uri() . '/js/animate.js', array('jquery'), '1.0.0', true );
wp_enqueue_script( 'jquery-countdown', get_template_directory_uri() . '/js/jquery.countdown.js', array('jquery'), '1.0.0', true );
wp_enqueue_script( 'wow', get_template_directory_uri() . '/js/wow.min.js', array('jquery'), '1.0.0', true );
wp_enqueue_script( 'stickykit', get_template_directory_uri() . '/js/jquery.sticky-kit.min.js', array('jquery'), '1.0.0', true );
wp_enqueue_script( 'loaders', get_template_directory_uri() . '/js/loaders.css.js', array('jquery'), '1.0.0', true );
wp_enqueue_script( 'bitwallet-custom-js', get_template_directory_uri() . '/js/bitwallet-custom.js', array('jquery'), '1.0.0', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'bitwallet_scripts' );
/**
||-> Enqueue admin css/js
*/
function bitwallet_enqueue_admin_scripts( $hook ) {
// JS
wp_enqueue_script( "bitwallet_admin_scripts", get_template_directory_uri().'/js/bitwallet-admin-scripts.js' , array( 'jquery' ) );
wp_enqueue_script( "loaders", get_template_directory_uri().'/js/loaders.css.js' , array( 'jquery' ) );
// CSS
wp_enqueue_style( "bitwallet_admin_css", get_template_directory_uri().'/css/admin-style.css' );
wp_enqueue_style( "loaders", get_template_directory_uri().'/css/loaders.css' );
}
add_action('admin_enqueue_scripts', 'bitwallet_enqueue_admin_scripts');
/**
||-> Enqueue css to js_composer
*/
add_action( 'vc_base_register_front_css', 'bitwallet_enqueue_front_css_foreever' );
function bitwallet_enqueue_front_css_foreever() {
wp_enqueue_style( 'js_composer_front' );
}
/**
||-> Other required parts/files
*/
/* ========= LOAD CUSTOM FUNCTIONS ===================================== */
require_once get_template_directory() . '/inc/custom-functions.php';
require_once get_template_directory() . '/inc/custom-functions.header.php';
require_once get_template_directory() . '/inc/custom-functions.footer.php';
/* ========= Customizer additions. ===================================== */
require_once get_template_directory() . '/inc/customizer.php';
/* ========= Load Jetpack compatibility file. ===================================== */
require_once get_template_directory() . '/inc/jetpack.php';
/* ========= Include the TGM_Plugin_Activation class. ===================================== */
require_once get_template_directory() . '/inc/tgm/include_plugins.php';
/* ========= CUSTOM COMMENTS ===================================== */
require_once get_template_directory() . '/inc/custom-comments.php';
/* ========= THEME DEFAULTS ===================================== */
require_once get_template_directory() . '/inc/theme-defaults.php';
/* ========= Include Theme Info page. ===================================== */
require get_template_directory() . '/inc/theme-info.php';
/**
||-> add_image_size //Resize images
*/
/* ========= RESIZE IMAGES ===================================== */
add_image_size( 'bitwallet_related_post_pic500x300', 500, 300, true );
add_image_size( 'bitwallet_post_pic700x450', 700, 450, true );
// Blogloop-v2
add_image_size( 'bitwallet_blog_900x550', 900, 550, true );
add_image_size( 'bitwallet_blog_1400x350', 1400, 350, true );
/**
||-> LIMIT POST CONTENT
*/
function bitwallet_excerpt_limit($string, $word_limit) {
$words = explode(' ', $string, ($word_limit + 1));
if(count($words) > $word_limit) {
array_pop($words);
}
return implode(' ', $words);
}
/**
||-> BREADCRUMBS
*/
function bitwallet_breadcrumb() {
$delimiter = '';
$html = '';
$name = esc_html__("Home", "bitwallet");
$currentBefore = '';
$currentAfter = '';
if (!is_home() && !is_front_page() || is_paged()) {
global $post;
$home = esc_url(home_url('/'));
$html .= '' . esc_attr($name) . ' ' . esc_attr($delimiter) . '';
if (is_category()) {
global $wp_query;
$cat_obj = $wp_query->get_queried_object();
$thisCat = $cat_obj->term_id;
$thisCat = get_category($thisCat);
$parentCat = get_category($thisCat->parent);
if ($thisCat->parent != 0)
$html .= (get_category_parents($parentCat, true, '' . esc_attr($delimiter) . ''));
$html .= $currentBefore . single_cat_title('', false) . $currentAfter;
}elseif (is_tax()) {
global $wp_query;
$html .= $currentBefore . single_cat_title('', false) . $currentAfter;
} elseif (is_day()) {
$html .= '' . get_the_time('Y') . ' ' . esc_attr($delimiter) . '';
$html .= '' . get_the_time('F') . ' ' . esc_attr($delimiter) . ' ';
$html .= $currentBefore . get_the_time('d') . $currentAfter;
} elseif (is_month()) {
$html .= '' . get_the_time('Y') . ' ' . esc_attr($delimiter) . '';
$html .= $currentBefore . get_the_time('F') . $currentAfter;
} elseif (is_year()) {
$html .= $currentBefore . get_the_time('Y') . $currentAfter;
} elseif (is_attachment()) {
$html .= $currentBefore;
$html .= get_the_title();
$html .= $currentAfter;
} elseif (is_single()) {
if (get_the_category()) {
$cat = get_the_category();
$cat = $cat[0];
$html .= '' . get_category_parents($cat, true, ' ' . esc_attr($delimiter) . '') . '';
}
$html .= $currentBefore;
$html .= get_the_title();
$html .= $currentAfter;
} elseif (is_page() && !$post->post_parent) {
$html .= $currentBefore;
$html .= get_the_title();
$html .= $currentAfter;
} elseif (is_page() && $post->post_parent) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '' . get_the_title($page->ID) . '';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
foreach ($breadcrumbs as $crumb)
$html .= $crumb . ' ' . esc_attr($delimiter) . ' ';
$html .= $currentBefore;
$html .= get_the_title();
$html .= $currentAfter;
} elseif (is_search()) {
$html .= $currentBefore . get_search_query() . $currentAfter;
} elseif (is_tag()) {
$html .= $currentBefore . single_tag_title( '', false ) . $currentAfter;
} elseif (is_author()) {
global $author;
$userdata = get_userdata($author);
$html .= $currentBefore . $userdata->display_name . $currentAfter;
} elseif (is_404()) {
$html .= $currentBefore . esc_html__('404 Not Found','bitwallet') . $currentAfter;
}
if (get_query_var('paged')) {
if (is_home() || is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author())
$html .= $currentBefore;
$html .= esc_html__('Page','bitwallet') . ' ' . get_query_var('paged');
if (is_home() || is_category() || is_day() || is_month() || is_year() || is_search() || is_tag() || is_author())
$html .= $currentAfter;
}
}
return $html;
}
/**
||-> PAGINATION
*/
if ( ! function_exists( 'bitwallet_pagination' ) ) {
function bitwallet_pagination($query = null) {
if (!$query) {
global $wp_query;
$query = $wp_query;
}
$big = 999999999; // need an unlikely integer
$current = (get_query_var('paged')) ? get_query_var('paged') : ((get_query_var('page')) ? get_query_var('page') : '1');
echo paginate_links(
array(
'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),
'format' => '?paged=%#%',
'current' => max( 1, $current ),
'total' => $query->max_num_pages,
'prev_text' => '«',
'next_text' => '»',
)
);
}
}
/* Remove error validator : Bad value https://api.w.org/ for attribute rel on element link */
remove_action( 'wp_head','rest_output_link_wp_head');
/**
||-> FUNCTION: ADD EDITOR STYLE
*/
function bitwallet_add_editor_styles() {
add_editor_style( 'css/custom-editor-style.css' );
}
add_action( 'admin_init', 'bitwallet_add_editor_styles' );
?>