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' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary', 'swiftpress' ),
'secondary'=>esc_html__( 'Secondary' ,'swiftpress')
) );
/*
* 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( 'swiftpress_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
}
endif;
add_action( 'after_setup_theme', 'swiftpress_setup' );
define('HEADER_IMAGE_WIDTH', 1920);
define('HEADER_IMAGE_HEIGHT', 1000);
/**
* 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
*/
function swiftpress_content_width() {
$GLOBALS['content_width'] = apply_filters( 'swiftpress_content_width', 640 );
}
add_action( 'after_setup_theme', 'swiftpress_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function swiftpress_widgets_init() {
register_sidebar( array(
'name' => __(' Right Sidebar','swiftpress'),
'id' => 'sidebar-1',
'description' => __('Drag your widgets for Right Sidebar here','swiftpress'),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
) );
register_sidebar( array(
'name' => __(' Left Sidebar','swiftpress'),
'id' => 'left_sidebar',
'description' => __('Drag your widgets for Right Sidebar here','swiftpress'),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
) );
register_sidebar( array(
'name' => __(' Footer left Sidebar','swiftpress'),
'id' => 'footer_left',
'description' => __('Drag your widgets for Footer left here(One Text widget is recommended for this sidebar)','swiftpress'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
) );
register_sidebar( array(
'name' => __(' Footer Right Sidebar','swiftpress'),
'id' => 'footer_right',
'description' => __('Drag your widgets for Footer Right here(Two widgets are recommended for this sidebar )','swiftpress'),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
) );
register_sidebar( array(
'name' => __(' Home Page Widget Area','swiftpress'),
'id' => 'newsletter',
'description' => __('Drag your widgets for home page here(Newsletter widget recommended for this sidebar )','swiftpress'),
'before_widget' => '
' .esc_attr( get_the_date(__('M','swiftpress')) ). ' '
.esc_attr( get_the_date(__(' Y','swiftpress')) ). '';
}
//filter for making current menu active
add_filter('nav_menu_css_class' , 'swiftpress_special_nav_class' , 10 , 2);
function swiftpress_special_nav_class($classes, $item){
if( in_array('current-menu-item', $classes) ){
$classes[] = 'active ';
}
return $classes;
}
if ( ! function_exists( 'swiftpress_breadcrumbs' ) ) {
function swiftpress_breadcrumbs() {
$showOnHome = 0; // 1 - show breadcrumbs on the homepage, 0 - don't show
$delimiter = ''; // delimiter between crumbs
$home = get_bloginfo('name'); // text for the 'Home' link
$showCurrent = 1; // 1 - show current post/page title in breadcrumbs, 0 - don't show
$before = ''; // tag before the current crumb
$after = ''; // tag after the current crumb
global $post;
$homeLink = esc_url( home_url() );
if (is_home() || is_front_page()) {
if ($showOnHome == 1) echo '