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;
if ( ! function_exists( 'blog64_pagination_bar' ) ) :
function blog64_pagination_bar() {
global $wp_query;
$total_pages = $wp_query->max_num_pages;
if ($total_pages > 1){
$previous_page = max(-1, get_query_var('paged'));
$current_page = max(1, get_query_var('paged'));
echo paginate_links(array(
'style' => 'ul class="paging-navigation"',
'base' => get_pagenum_link(1) . '%_%',
'format' => '/page/%#%',
'previous' => $previous_page,
'current' => $current_page,
'total' => $total_pages,
));
}
}
endif;
if ( ! function_exists( 'blog64_pagination_bars' ) ) :
/**
* Display navigation to next/previous set of posts when applicable.
*/
function blog64_pagination_bars() {
// Don't print empty markup if there's only one page.
if ( $GLOBALS['wp_query']->max_num_pages < 1 ) {
return;
}
$paged = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
$pagenum_link = html_entity_decode( get_pagenum_link() );
$query_args = array();
$url_parts = explode( '?', $pagenum_link );
if ( isset( $url_parts[1] ) ) {
wp_parse_str( $url_parts[1], $query_args );
}
$pagenum_link = remove_query_arg( array_keys( $query_args ), $pagenum_link );
$pagenum_link = trailingslashit( $pagenum_link ) . '%_%';
$format = $GLOBALS['wp_rewrite']->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
$format .= $GLOBALS['wp_rewrite']->using_permalinks() ? user_trailingslashit( 'page/%#%', 'paged' ) : '?paged=%#%';
// Set up paginated links.
$links = paginate_links( array(
'base' => $pagenum_link,
'format' => $format,
'total' => $GLOBALS['wp_query']->max_num_pages,
'current' => $paged,
'mid_size' => 2,
'add_args' => array_map( 'urlencode', $query_args ),
'prev_text' => __( '«', 'blog64' ),
'next_text' => __( '»', 'blog64' ),
'type' => 'list',
) );
if ( $links ) :
?>
post_parent ) : get_adjacent_post( false, '', true );
$next = get_adjacent_post( false, '', false );
if ( ! $next && ! $previous ) {
return;
}
?>
=$limit) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt).'...';
} else {
$excerpt = implode(" ",$excerpt);
}
$excerpt = preg_replace('`\[[^\]]*\]`','',$excerpt);
return $excerpt;
}
function blog64_content($limit) {
$content = explode(' ', get_the_content(), $limit);
if (count($content)>=$limit) {
array_pop($content);
$content = implode(" ",$content).'...';
} else {
$content = implode(" ",$content);
}
$content = preg_replace('/\[.+\]/','', $content);
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
return $content;
}
if ( ! function_exists( 'blog64_exclude_category' ) ) :
//Exclude Category Posts from Home Page
function blog64_exclude_category($query) {
if ( $query->is_home() ) {
$query->set('cat', '-1');//add your category number
}
return $query;
}
add_filter('pre_get_posts', 'blog64_exclude_category');
endif;
if ( ! function_exists( 'blog64_breadcrumbs' ) ) :
function blog64_breadcrumbs() {
echo '';
if (!is_home()) {
echo '- ';
echo 'Home';
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"- Archive for "; the_time('F jS, Y'); echo'
';}
elseif (is_month()) {echo"- Archive for "; the_time('F, Y'); echo'
';}
elseif (is_year()) {echo"- Archive for "; the_time('Y'); echo'
';}
elseif (is_author()) {echo"- Author Archive"; echo'
';}
elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {echo "- Blog Archives"; echo'
';}
elseif (is_search()) {echo"- Search Results"; echo'
';}
echo '
';
}
endif;
/**
* Enqueue scripts and styles.
*/
function blog64_scripts() {
wp_enqueue_style( 'blog64-style', get_stylesheet_uri() );
wp_enqueue_style( 'blog64-bootstrap', get_template_directory_uri().'/css/bootstrap.css' );
wp_enqueue_style( 'blog64-fontawesome', get_template_directory_uri().'/css/font-awesome.css' );
wp_enqueue_style( 'blog64-animate', get_template_directory_uri().'/css/animate.css' );
wp_enqueue_style( 'blog64-magnific-popup', get_template_directory_uri().'/css/magnific-popup.css' );
wp_enqueue_style('blog64-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( 'blog64-jquery-min', get_template_directory_uri() . '/js/jquery.min.js', array(), '1.0.0', true );
wp_enqueue_script( 'blog64-bootstrap', get_template_directory_uri() . '/js/bootstrap.js', array(), '1.0.0', true );
wp_enqueue_script( 'blog64-jquery-smartmenus-bootstrap', get_template_directory_uri() . '/js/jquery.smartmenus.bootstrap.js', array(), '1.0.0', true );
wp_enqueue_script( 'blog64-jquery-smartmenus-min', get_template_directory_uri() . '/js/jquery.smartmenus.min.js', array(), '1.0.0', true );
wp_enqueue_script( 'blog64-jquery-magnific-popup', get_template_directory_uri() . '/js/jquery.magnific-popup.min.js', array(), '1.0.0', true );
wp_enqueue_script( 'blog64-wow', get_template_directory_uri() . '/js/wow.min.js', array(), '1.0.0', true );
wp_enqueue_script( 'blog64-scripts', get_template_directory_uri() . '/js/script.js', array(), '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';