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( 'figure-thumb', 360, 240, true ); // Home Blog Page
add_image_size( 'header-full', 1900, 700, true ); // Header background
add_image_size( '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', 'blog-64' ),
'secondary' => esc_html__( 'Footer Menu', 'blog-64' ),
) );
/*
* 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( 'blog_64_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
}
endif; // blog_64_setup
add_action( 'after_setup_theme', 'blog_64_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 blog_64_content_width() {
$GLOBALS['content_width'] = apply_filters( 'blog_64_content_width', 640 );
}
add_action( 'after_setup_theme', 'blog_64_content_width', 0 );
function blog_64_filter_front_page_template( $template ) {
return is_home() ? '' : $template;
}
add_filter( 'front_page_template', 'blog_64_filter_front_page_template' );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function blog_64_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar Left', 'blog-64' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar Right', 'blog-64' ),
'id' => 'sidebar-2',
'description' => '',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Blocks', 'blog-64' ),
'id' => 'footer-blocks',
'description' => '',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'blog_64_widgets_init' );
function blog_64_fonts_url() {
$fonts_url = '';
/* Translators: If there are characters in your language that are not
* supported by Josefin Sans, translate this to 'off'. Do not translate
* into your own language.
*/
$josefin = _x( 'on', 'Josefin Sans font: on or off', 'blog-64' );
/* Translators: If there are characters in your language that are not
* supported by Open Sans, translate this to 'off'. Do not translate
* into your own language.
*/
$open_sans = _x( 'on', 'Open Sans font: on or off', 'blog-64' );
if ( 'off' !== $josefin || 'off' !== $open_sans ) {
$font_families = array();
if ( 'off' !== $josefin ) {
$font_families[] = 'Josefin Sans:300,400,700,400italic';
}
if ( 'off' !== $open_sans ) {
$font_families[] = 'Open Sans:700italic,300,400,800,600';
}
$query_args = array(
'family' => urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( 'latin,latin-ext' ),
);
$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
}
return esc_url_raw( $fonts_url );
}
function blog_64_scripts_styles() {
wp_enqueue_style( 'blog_64-fonts', blog_64_fonts_url(), array(), null );
}
add_action( 'wp_enqueue_scripts', 'blog_64_scripts_styles' );
function blog_64_editor_styles() {
add_editor_style( array( 'editor-style.css', blog_64_fonts_url() ) );
}
add_action( 'after_setup_theme', 'blog_64_editor_styles' );
function blog_64_custom_header_fonts() {
wp_enqueue_style( 'blog_64-fonts', blog_64_fonts_url(), array(), null );
}
add_action( 'admin_print_styles-appearance_page_custom-header', 'blog_64_scripts_styles' );
function blog_64_title( $before = '', $after = '' ) {
if ( is_category() ) {
echo single_cat_title();
} else
echo the_title();
}
if ( ! function_exists( 'blog_64_get_link_url' ) ) :
function blog_64_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( 'blog_64_pagination_bar' ) ) :
function blog_64_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( 'blog_64_pagination_bars' ) ) :
/**
* Display navigation to next/previous set of posts when applicable.
*/
function blog_64_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' => __( '«', 'blog-64' ),
'next_text' => __( '»', 'blog-64' ),
'type' => 'list',
) );
if ( $links ) :
?>