for posts and comments.
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'custom-header' );
add_theme_support( 'custom-background' );
add_theme_support( 'html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
) );
add_theme_support( 'custom-logo', array(
'height' => 80,
'width' => 150,
'flex-height' => true,
'flex-width' => true,
'header-text' => array( 'site-title', 'site-description' ),
) );
// register nav menu
register_nav_menus( array(
'primary-menu' => esc_html__( 'Primary Menu', 'belfast' ),
) );
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 604, 280, true );
// This theme uses its own gallery styles.
add_filter( 'use_default_gallery_style', '__return_false' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded
tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
load_theme_textdomain('belfast', get_template_directory() . '/languages');
}
add_action( 'after_setup_theme', 'belfast_setup' );
/**
* Return the Google font stylesheet URL, if available.
*/
function belfast_fonts_url() {
$fonts_url = '';
/* Translators: If there are characters in your language that are not
* supported by Source Sans Pro, translate this to 'off'. Do not translate
* into your own language.
*/
$source_sans_pro = _x( 'on', 'Source Sans Pro font: on or off', 'belfast' );
/* Translators: If there are characters in your language that are not
* supported by Lato, translate this to 'off'. Do not translate into your
* own language.
*/
$lato = _x( 'on', 'Lato font: on or off', 'belfast' );
if ( 'off' !== $source_sans_pro || 'off' !== $lato ) {
$font_families = array();
if ( 'off' !== $source_sans_pro )
$font_families[] = 'Source Sans Pro:300,400,700,300italic,400italic,700italic';
if ( 'off' !== $lato )
$font_families[] = 'Lato:400,700,400italic';
$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;
}
/**
* Enqueue scripts and styles for the front end. */
function belfast_scripts_styles() {
/*
* Adds JavaScript to pages with the comment form to support */
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
// Adds Masonry to handle vertical alignment of footer widgets.
if ( is_active_sidebar( 'sidebar-1' ) )
wp_enqueue_script( 'jquery-masonry' );
// Loads JavaScript file with functionality specific to belfast.
wp_enqueue_script( 'belfast-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '2014-03-18', true );
// Add Source Sans Pro and Lato fonts, used in the main stylesheet.
wp_enqueue_style( 'belfast-fonts', belfast_fonts_url(), array(), null );
// Add Genericons font, used in the main stylesheet.
wp_enqueue_style( 'genericons', get_template_directory_uri() . '/fonts/genericons.css', array(), '2.09' );
// Add single stylesheet.
wp_enqueue_style( 'belfast-single', get_template_directory_uri() . '/css/single.css', array(), '2.09' );
// Add stylesheet.
wp_enqueue_style( 'belfast-stylesheet', get_template_directory_uri() . '/fonts/stylesheet.css', array(), '2.09' );
// Loads our main stylesheet.
wp_enqueue_style( 'belfast-style', get_stylesheet_uri(), array(), '2013-07-18' );
// Loads the Internet Explorer specific stylesheet.
wp_enqueue_style( 'ie', get_template_directory_uri() . '/css/ie.css', array( 'belfast-style' ), '2013-07-18' );
wp_style_add_data( 'ie', 'conditional', 'lt IE 9' );
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.css');
wp_enqueue_style( 'slicknav', get_template_directory_uri() . '/css/slicknav.css');
wp_enqueue_style( 'belfast-responsive', get_template_directory_uri().'/css/responsive.css');
wp_enqueue_script( 'jquery-slicknav', get_template_directory_uri() . '/js/jquery.slicknav.js', array( 'jquery' ), true );
wp_enqueue_script( 'belfast-custom-script', get_template_directory_uri() . '/js/scripts.js', array( 'jquery', 'imagesloaded' ), true );
}
add_action( 'wp_enqueue_scripts', 'belfast_scripts_styles' );
/* Filter the page title. */
function belfast_wp_title( $title, $sep ) {
global $paged, $page;
if ( is_feed() )
return $title;
// Add a page number if necessary.
if ( $paged >= 2 || $page >= 2 )
$title = "$title $sep " . sprintf( __( 'Page %s', 'belfast' ), max( $paged, $page ) );
return $title;
}
add_filter( 'wp_title', 'belfast_wp_title', 10, 2 );
# No Title
function belfast_the_title ( $title ) {
if ( in_the_loop() && ! is_page() ) {
if ( ! $title )
$title = __( 'Untitled', 'belfast' );
}
return $title;
}
add_filter( 'the_title', 'belfast_the_title' );
/* Register two widget areas. */
function belfast_widgets_init() {
register_sidebar( array(
'name' => __( 'Main Widget Area', 'belfast' ),
'id' => 'sidebar-1',
'description' => __( 'Appears in the footer section of the site.', 'belfast' ),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
) );
}
add_action( 'widgets_init', 'belfast_widgets_init' );
// WP post link pages
function belfast_link_pages(){
wp_link_pages( array(
'before' => '