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( 820, 350, true );
add_image_size( 'blog64-figure-thumb', 360, 240, true ); // Home Blog Page
add_image_size( 'blog64-header-full', 1920, 720, true ); // Header background
add_image_size( 'blog64-single-full', 999999, 350, true ); // Single Page
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary Menu', 'blog64' ),
) );
/*
* 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',
) );
/*
* Enable support for Post Formats.
* See https://developer.wordpress.org/themes/functionality/post-formats/
*/
add_theme_support( 'post-formats', array(
'aside',
'image',
'video',
'quote',
'link',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'blog64_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
}
endif; // blog64_setup
add_action( 'after_setup_theme', 'blog64_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
*/
if ( ! isset( $content_width ) ) $content_width = 900;
function blog64_content_width() {
$GLOBALS['content_width'] = apply_filters( 'blog64_content_width', 640 );
}
add_action( 'after_setup_theme', 'blog64_content_width', 0 );
function blog64_filter_front_page_template( $template ) {
return is_home() ? '' : $template;
}
add_filter( 'front_page_template', 'blog64_filter_front_page_template' );
if( !function_exists( 'blog64_editor_styles' ) ):
/**
* Sets up theme defaults and registers support for various WordPress features.
*/
function blog64_editor_styles() {
add_editor_style( 'editor-style.css' );
}
endif;
add_action( 'admin_init', 'blog64_editor_styles' );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function blog64_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar Left', 'blog64' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Right', 'blog64' ),
'id' => 'sidebar-2',
'description' => '',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Blocks', 'blog64' ),
'id' => 'footer-blocks',
'description' => '',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'blog64_widgets_init' );
function blog64_title( $before = '', $after = '' ) {
if ( is_category() ) {
echo single_cat_title();
} else
echo the_title();
}
if ( ! function_exists( 'blog64_get_link_url' ) ) :
function blog64_get_link_url() {
$content = get_the_content();
$has_url = get_url_in_content( $content );
return ( $has_url ) ? $has_url : apply_filters( 'the_permalink', get_permalink() );
}
endif;
add_filter( 'widget_tag_cloud_args', 'blog64_tag_cloud_args' );
function blog64_tag_cloud_args( $args ) {
$args['number'] = 10; // Your extra arguments go here
$args['largest'] = 18;
$args['smallest'] = 12;
$args['unit'] = 'px';
return $args;
}
function blog64_custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'blog64_custom_excerpt_length', 999 );
if ( ! function_exists( 'blog64_breadcrumbs' ) ) :
function blog64_breadcrumbs() {
echo '';
if (!is_home()) {
echo '- ';
echo _e( 'Home', 'blog64' );
echo "
";
if (is_category() || is_single()) {
echo '- ';
the_category('
- ');
if (is_single()) {
echo "
- ";
the_title();
echo '
';
}
} elseif (is_page()) {
echo '- ';
echo the_title();
echo '
';
}
}
elseif (is_tag()) {single_tag_title();}
elseif (is_day()) {echo"- _e( 'Archive for', 'blog64' ); "; the_time('F jS, Y'); echo'
';}
elseif (is_month()) {echo"- _e( 'Archive for', 'blog64' ); "; the_time('F, Y'); echo'
';}
elseif (is_year()) {echo"- _e( 'Archive for', 'blog64' ); "; the_time('Y'); echo'
';}
elseif (is_author()) {echo"- _e( 'Author Archive for', 'blog64' ); ";echo'
';}
elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {echo "- _e( 'Blog Archive for', 'blog64' ); "; echo'
';}
elseif (is_search()) {echo"- _e( 'Search Results', 'blog64' ); "; echo'
';}
echo '
';
}
endif;
/**
* Enqueue scripts and styles.
*/
function blog64_scripts() {
wp_enqueue_style( 'blog64-style', get_stylesheet_uri() );
wp_enqueue_style( 'bootstrap', get_template_directory_uri().'/css/bootstrap.css' );
wp_enqueue_style( 'fontawesome', get_template_directory_uri().'/css/font-awesome.css' );
wp_enqueue_style( 'animate', get_template_directory_uri().'/css/animate.css' );
wp_enqueue_style( 'magnific-popup', get_template_directory_uri().'/css/magnific-popup.css' );
wp_enqueue_style( 'webfont', '//fonts.googleapis.com/css?family=Josefin+Sans:300,400,700,400italic,700italic|Open+Sans:700,900,400,300&subset=latin,latin-ext', array(), NULL);
wp_enqueue_style( 'blog64-main', get_template_directory_uri().'/css/main.css' );
wp_enqueue_script('jquery');
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.js', array('jquery'), '1.0.0', true );
wp_enqueue_script( 'jquery-smartmenus-bootstrap', get_template_directory_uri() . '/js/jquery.smartmenus.bootstrap.js', array('jquery'), '1.0.0', true );
wp_enqueue_script( 'jquery-smartmenus-min', get_template_directory_uri() . '/js/jquery.smartmenus.min.js', array('jquery'), '1.0.0', true );
wp_enqueue_script( 'jquery-magnific-popup', get_template_directory_uri() . '/js/jquery.magnific-popup.min.js', array('jquery'), '1.0.0', true );
wp_enqueue_script( 'wow-min', get_template_directory_uri() . '/js/wow.min.js', array('jquery'), '1.0.0', true );
wp_enqueue_script( 'blog64-scripts', get_template_directory_uri() . '/js/script.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', 'blog64_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';
require get_template_directory() . '/inc/class.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
// Register Custom Navigation Walker
require get_template_directory() . '/inc/wp_bootstrap_navwalker.php';