for posts and comments.
add_theme_support( 'automatic-feed-links' );
// This theme supports custom background color and image.
$defaults = array(
'default-color' => '',
'default-image' => '',
'wp-head-callback' => '_custom_background_cb',
'admin-head-callback' => '',
'admin-preview-callback' => '' );
add_theme_support( 'custom-background', $defaults );
// This theme uses a custom image size for featured images, displayed on "standard" posts.
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 634, 9999 );
add_image_size( 'fullwidth-thumb', 924, 9999 );
}
add_action( 'after_setup_theme', 'brightnews_setup' );
/**
* Enqueues scripts and styles for front-end.
*
*/
function brightnews_scripts_styles() {
global $wp_styles;
// Adds JavaScript
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
wp_enqueue_script( 'placeholders', get_template_directory_uri() . '/js/placeholders.js', array(), '2.1.0', true );
wp_enqueue_script( 'scroll-to-top', get_template_directory_uri() . '/js/scroll-to-top.js', array( 'jquery' ), '1.0', true );
wp_enqueue_script( 'selectnav', get_template_directory_uri() . '/js/selectnav.js', array(), '0.1', true );
wp_enqueue_script( 'responzive', get_template_directory_uri() . '/js/responzive.js', array(), '1.0', true );
// Loads the main stylesheet.
wp_enqueue_style( 'brightnews-style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'brightnews_scripts_styles' );
/**
* Sets up the content width value based on the theme's design and stylesheet.
*
*/
if ( ! isset( $content_width ) )
$content_width = 640;
/**
* Creates a nicely formatted and more specific title element text.
*
*/
function brightnews_wp_title( $title, $sep ) {
if ( is_feed() )
return $title;
$title .= get_bloginfo( 'name' );
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
$title = "$title $sep $site_description";
return $title;
}
add_filter( 'wp_title', 'brightnews_wp_title', 10, 2 );
/**
* Register our menus.
*
*/
function brightnews_register_my_menus() {
register_nav_menus(
array(
'main-navigation' => __( 'Main Header Menu', 'brightnews' ),
'top-navigation' => __( 'Top Header Menu', 'brightnews' )
)
);
}
add_action( 'after_setup_theme', 'brightnews_register_my_menus' );
/**
* Register our sidebars and widgetized areas.
*
*/
function brightnews_widgets_init() {
register_sidebar( array(
'name' => __( 'Right Sidebar', 'brightnews' ),
'id' => 'sidebar-1',
'description' => __( 'Right sidebar which appears on all posts and pages.', 'brightnews' ),
'before_widget' => '
',
'before_title' => ' ',
) );
register_sidebar( array(
'name' => __( 'Footer left widget area', 'brightnews' ),
'id' => 'sidebar-2',
'description' => __( 'Left column with widgets in footer.', 'brightnews' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer middle widget area', 'brightnews' ),
'id' => 'sidebar-3',
'description' => __( 'Middle column with widgets in footer.', 'brightnews' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer right widget area', 'brightnews' ),
'id' => 'sidebar-4',
'description' => __( 'Right column with widgets in footer.', 'brightnews' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer notices', 'brightnews' ),
'id' => 'sidebar-5',
'description' => __( 'The line for copyright and other notices below the footer widget areas. Insert here one Text widget. The "Title" field at this widget should stay empty.', 'brightnews' ),
'before_widget' => '',
'before_title' => '',
'after_title' => '',
) );
register_sidebar( array(
'name' => __( 'Homepage slideshow', 'brightnews' ),
'id' => 'sidebar-6',
'description' => __( 'The area for Cyclone Slider Widget which displays a slideshow on your homepage.', 'brightnews' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '',
) );
register_sidebar( array(
'name' => __( 'Homepage posts', 'brightnews' ),
'id' => 'sidebar-7',
'description' => __( 'The area for any BrightNews Homepage Widgets, which display latest posts from a specific category.', 'brightnews' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
) );
}
add_action( 'widgets_init', 'brightnews_widgets_init' );
if ( ! function_exists( 'brightnews_content_nav' ) ) :
/**
* Displays navigation to next/previous pages when applicable.
*
*/
function brightnews_content_nav( $html_id ) {
global $wp_query;
$html_id = esc_attr( $html_id );
if ( $wp_query->max_num_pages > 1 ) : ?>
← Older posts', 'brightnews' ) ); ?>
→', 'brightnews' ) ); ?>
comment_type ) :
case 'pingback' :
case 'trackback' :
?>
id="comment-">
', '' ); ?>
id="li-comment-">
$object ) {
if ( 0 == $object->menu_item_parent ) {
$top_ids[$i] = $object;
continue;
}
if ( ! in_array( $object->menu_item_parent, $ids ) ) {
$objects[$i]->classes[] = 'first-menu-item';
$ids[] = $object->menu_item_parent;
}
if ( in_array( 'first-menu-item', $object->classes ) )
continue;
$parent_ids[$i] = $object->menu_item_parent;
}
$sanitized_parent_ids = array_unique( array_reverse( $parent_ids, true ) );
foreach ( $sanitized_parent_ids as $i => $id )
$objects[$i]->classes[] = 'last-menu-item';
return $objects;
}
/**
* Include the TGM_Plugin_Activation class.
*
*/
require_once get_template_directory() . '/class-tgm-plugin-activation.php';
add_action( 'tgmpa_register', 'brightnews_my_theme_register_required_plugins' );
function brightnews_my_theme_register_required_plugins() {
$plugins = array(
array(
'name' => 'Breadcrumb NavXT',
'slug' => 'breadcrumb-navxt',
'source' => get_template_directory_uri() . '/plugins/breadcrumb-navxt.zip',
'required' => false,
),
array(
'name' => 'Cyclone Slider 2',
'slug' => 'cyclone-slider',
'source' => get_template_directory_uri() . '/plugins/cyclone-slider-2.zip',
'required' => false,
),
);
$config = array(
'domain' => 'brightnews',
'menu' => 'install-my-theme-plugins',
'strings' => array(
'page_title' => __( 'Install Required Plugins', 'brightnews' ),
'menu_title' => __( 'Install Plugins', 'brightnews' ),
'instructions_install' => __( 'The %1$s plugin is required for this theme. Click on the big blue button below to install and activate %1$s.', 'brightnews' ),
'instructions_activate' => __( 'The %1$s is installed but currently inactive. Please go to the plugin administration page page to activate it.', 'brightnews' ),
'button' => __( 'Install %s Now', 'brightnews' ),
'installing' => __( 'Installing Plugin: %s', 'brightnews' ),
'oops' => __( 'Something went wrong with the plugin API.', 'brightnews' ), // */
'notice_can_install' => __( 'This theme requires the %1$s plugin. Click here to begin the installation process. You may be asked for FTP credentials based on your server setup.', 'brightnews' ),
'notice_cannot_install' => __( 'Sorry, but you do not have the correct permissions to install the %s plugin. Contact the administrator of this site for help on getting the plugin installed.', 'brightnews' ),
'notice_can_activate' => __( 'This theme requires the %1$s plugin. That plugin is currently inactive, so please go to the plugin administration page to activate it.', 'brightnews' ),
'notice_cannot_activate' => __( 'Sorry, but you do not have the correct permissions to activate the %s plugin. Contact the administrator of this site for help on getting the plugin activated.', 'brightnews' ),
'return' => __( 'Return to Required Plugins Installer', 'brightnews' ),
),
);
tgmpa( $plugins, $config );
}
/**
* Custom Shortcodes.
*
*/
function brightnews_button_shortcode($atts, $content = null) {
extract(shortcode_atts(array('link' => '#'), $atts));
return '' . do_shortcode($content) . '';
}
add_shortcode( 'button', 'brightnews_button_shortcode' );
add_filter('widget_text', 'do_shortcode');
function brightnews_highlight_shortcode($atts, $content = null) {
return '' . do_shortcode($content) . '';
}
add_shortcode( 'highlight', 'brightnews_highlight_shortcode' );
function brightnews_image_shortcode($atts, $content = null){
return '
';
}
add_shortcode('image','brightnews_image_shortcode'); ?>