__( 'Main Menu', 'blogr' ), ) ); // Add support for a featured image and the size add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 300, 300, true ); add_image_size( 'blogr_home', 500, 333, true ); add_image_size( 'blogr_featured', 832, 300, true ); add_image_size( 'blogr_single', 1600, 400, true ); // Adds RSS feed links to for posts and comments. add_theme_support( 'automatic-feed-links' ); } endif; // Display a admin notices add_action( 'admin_notices', 'blogr_admin_notice' ); function blogr_admin_notice() { global $current_user; $blogr_pro = 'http://themes4wp.com/product/blogr-pro/'; $user_id = $current_user->ID; /* Check that the user hasn't already clicked to ignore the message */ if ( !get_user_meta( $user_id, 'blogr_ignore_notice' ) ) { echo '

'; printf( __( 'Like BlogR theme? You will LOVE BlogR PRO!', 'blogr' ) . ' ' . __( 'Click here for all the exciting features.', 'blogr' ) . '', '?blogr_notice_ignore=0' ); echo "

"; } } add_action( 'admin_init', 'blogr_notice_ignore' ); function blogr_notice_ignore() { global $current_user; $user_id = $current_user->ID; /* If user clicks to ignore the notice, add that to their user meta */ if ( isset( $_GET[ 'blogr_notice_ignore' ] ) && '0' == $_GET[ 'blogr_notice_ignore' ] ) { add_user_meta( $user_id, 'blogr_ignore_notice', 'true', true ); } } //////////////////////////////////////////////////////////////////// // Set Content Width //////////////////////////////////////////////////////////////////// function blogr_content_width() { $GLOBALS['content_width'] = apply_filters( 'blogr_content_width', 800 ); } add_action( 'after_setup_theme', 'blogr_content_width', 0 ); //////////////////////////////////////////////////////////////////// // Enqueue Styles //////////////////////////////////////////////////////////////////// function blogr_theme_stylesheets() { wp_enqueue_style( 'blogr-bootstrap', get_template_directory_uri() . '/css/bootstrap.css', array(), '1', 'all' ); wp_enqueue_style( 'blogr-stylesheet', get_stylesheet_uri(), array(), '1', 'all' ); // load Font Awesome css wp_enqueue_style( 'blogr-font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css' ); } add_action( 'wp_enqueue_scripts', 'blogr_theme_stylesheets' ); //////////////////////////////////////////////////////////////////// // Register Bootstrap JS with jquery //////////////////////////////////////////////////////////////////// function blogr_theme_js() { wp_enqueue_script( 'blogr-bootstrap-js', get_template_directory_uri() . '/js/bootstrap.js' ); wp_enqueue_script( 'blogr-theme-js', get_template_directory_uri() . '/js/customscript.js' ); } add_action( 'wp_enqueue_scripts', 'blogr_theme_js' ); //////////////////////////////////////////////////////////////////// // Register Custom Navigation Walker include custom menu widget to use walkerclass //////////////////////////////////////////////////////////////////// require_once('lib/wp_bootstrap_navwalker.php'); //////////////////////////////////////////////////////////////////// // Theme Info page //////////////////////////////////////////////////////////////////// if ( is_admin() ) { require_once(trailingslashit( get_template_directory() ) . 'lib/theme-info.php'); } //////////////////////////////////////////////////////////////////// // Register the Sidebar(s) //////////////////////////////////////////////////////////////////// add_action( 'widgets_init', 'blogr_widgets_init' ); function blogr_widgets_init() { register_sidebar( array( 'name' => __( 'Right Sidebar', 'blogr' ), 'id' => 'right-sidebar', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Left Sidebar', 'blogr' ), 'id' => 'left-sidebar', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Area After First Post', 'blogr' ), 'id' => 'post-area', 'description' => __( 'Suitable for text widget.', 'blogr' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } //////////////////////////////////////////////////////////////////// // Register hook and action to set Main content area col-md- width based on sidebar declarations //////////////////////////////////////////////////////////////////// add_action( 'blogr_main_content_width_hook', 'blogr_main_content_width_columns' ); function blogr_main_content_width_columns() { $columns = '12'; if ( get_theme_mod( 'rigth-sidebar-check', 1 ) != 0 ) { $columns = $columns - absint( get_theme_mod( 'right-sidebar-size', 3 ) ); } if ( get_theme_mod( 'left-sidebar-check', 0 ) != 0 ) { $columns = $columns - absint( get_theme_mod( 'left-sidebar-size', 3 ) ); } echo $columns; } function blogr_main_content_width() { do_action( 'blogr_main_content_width_hook' ); } if ( !function_exists( 'blogr_breadcrumb' ) ) : //////////////////////////////////////////////////////////////////// // Breadcrumbs //////////////////////////////////////////////////////////////////// function blogr_breadcrumb() { global $post, $wp_query; // schema link $home = esc_html__( 'Home', 'blogr' ); $delimiter = ' » '; $homeLink = home_url(); if ( is_home() || is_front_page() ) { // no need for breadcrumbs in homepage } else { echo ''; } } endif; //////////////////////////////////////////////////////////////////// // Social links //////////////////////////////////////////////////////////////////// if ( !function_exists( 'blogr_social_links' ) ) : /** * This function is for social links display on header * Get links through Theme Options */ function blogr_social_links() { $twp_social_links = array( 'twp_social_facebook' => 'Facebook', 'twp_social_twitter' => 'Twitter', 'twp_social_google' => 'Google-Plus', 'twp_social_instagram' => 'Instagram', 'twp_social_pin' => 'Pinterest', 'twp_social_youtube' => 'YouTube', 'twp_social_reddit' => 'Reddit', ); ?>