download it from here.'; } // Download the Disqus comment system if(!is_plugin_active( 'disqus-comment-system/disqus.php' )) { $plugin_messages[] = 'This theme requires you to install the Disqus comment system plugin, download it from here.'; } // Download the WordPress popular posts plugin if(!is_plugin_active( 'wordpress-popular-posts/wordpress-popular-posts.php' )) { $plugin_messages[] = 'This theme requires you to install the WordPress Popular Post plugin, download it from here.'; } if(count($plugin_messages) > 0) { echo '
'; foreach($plugin_messages as $message) { echo '

'.$message.'

'; } echo '
'; } } function include_css(){ wp_enqueue_style('style', get_stylesheet_uri() ); wp_enqueue_style('font', get_template_directory_uri() . '/css/bootstrap.min.css'); wp_enqueue_style('font1', get_template_directory_uri() . '/css/style.css'); wp_enqueue_style('font2', get_template_directory_uri() . '/css/ie10-viewport-bug-workaround.css'); wp_enqueue_script('font5', get_template_directory_uri() . '/js/ie-emulation-modes-warning.js'); wp_enqueue_script('font6', get_template_directory_uri() . '/js/jquery.min.js'); wp_enqueue_script('font7', get_template_directory_uri() . '/js/bootstrap.min.js'); wp_enqueue_script('font8', get_template_directory_uri() . '/js/ie10-viewport-bug-workaround.js'); wp_enqueue_script('font9', get_template_directory_uri() . '/js/inewsticker.js'); } add_action( 'wp_enqueue_scripts', 'include_css' ); //custome Menu add_action('after_setup_theme', 'my_themes_setup'); function my_themes_setup() { // Redux theme option connection /*if(!class_exists('ReduxFramework')){ require_once(dirname(__File__).'/bos_frmk/ReduxCore/framework.php'); } if(!isset($redux_demo)){ require_once(dirname(__File__).'/bos_frmk/sample/sample-config.php'); }*/ } // Redux Framework End require_once('wp_bootstrap_navwalker.php'); function register_my_menu() { register_nav_menu('header-top-menu',__( 'Header Top Menu', 'Blogazine_wct' )); register_nav_menu('footer',__( 'Footer Menu', 'Blogazine_wct' )); } add_action( 'init', 'register_my_menu' ); require_once(dirname(__File__).'/widgets/one_five_thumbs.php'); require_once(dirname(__File__).'/widgets/themnail_wedget.php'); require_once(dirname(__File__).'/widgets/latest_post.php'); require_once(dirname(__File__).'/widgets/one_themnail.php'); require_once(dirname(__File__).'/widgets/Listing_Post.php'); require_once(dirname(__File__).'/widgets/side_bar_themnail.php'); require_once(dirname(__File__).'/widgets/text_themnail.php'); require_once(dirname(__File__).'/widgets/one_three.php'); require_once(dirname(__File__).'/widgets/One_Big_&_Multi.php'); require_once(dirname(__File__).'/widgets/side_bar_2.php'); //add our widget location function ourWidgetsInit(){ register_sidebar(array( 'name'=>'Sidebar', 'id'=>'sidebar1' )); register_sidebar(array( 'name'=>'Home', 'id'=>'home' )); register_sidebar(array( 'name'=>'Home 2', 'id'=>'home2' )); register_sidebar(array( 'name'=>'advertisement Header', 'id'=>'add' )); } add_action( 'widgets_init', 'ourWidgetsInit' ); //Add Themenail add_action('after_setup_theme', 'suhail_theme_setup'); function suhail_theme_setup() { add_theme_support( 'post-thumbnails', array( 'post','news','page','blog', 'product' ) ); //Add Featured Image Support //add_image_size('205x390', 390,205, true); //add_image_size('625x390', 625,390, true); add_image_size('655x390', 655,390, true); // //add_image_size('315x390', 315,390, true); //add_image_size('585x390', 585,390, true); //add_image_size('165x78', 165,78, true); //add_image_size('195x78', 195,78, true); //add_image_size('322x100', 322,100, true); add_image_size('322x150', 322,150, true); // //add_image_size('650x390', 650,390, true); add_image_size('750x450', 750,490, true); // add_image_size('1349x600', 1349,600, true); // add_theme_support( 'automatic-feed-links' ); add_theme_support( "title-tag" ); $defaults = array( 'default-image' => '', 'width' => 0, 'height' => 0, 'flex-height' => false, 'flex-width' => false, 'uploads' => true, 'random-default' => false, 'header-text' => true, 'default-text-color' => '', 'wp-head-callback' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '', ); add_theme_support( 'custom-header', $defaults ); $defaults = array( 'default-color' => '', 'default-image' => '', 'default-repeat' => '', 'default-position-x' => '', 'default-attachment' => '', 'wp-head-callback' => '_custom_background_cb', 'admin-head-callback' => '', 'admin-preview-callback' => '' ); add_theme_support( 'custom-background', $defaults ); add_editor_style(); if ( ! isset( $content_width ) ) $content_width = 1000; } // Custom Post types for Portfolio on home page function custom_excerpt_length( $length ) { return 20; } add_filter( 'excerpt_length', 'custom_excerpt_length', 999 ); //Start News /*add_action('init', 'custom_post_news'); function custom_post_news() { $labels = array( 'name' => _x('News', 'post type general name', 'Blogazine_wct'), 'singular_name' => _x('News', 'post type singular name', 'Blogazine_wct'), 'add_new' => _x('Add New', 'News', 'Blogazine_wct'), 'add_new_item' => __('Add New News', 'Blogazine_wct'), 'edit_item' => __('Edit News', 'Blogazine_wct'), 'new_item' => __('New News', 'Blogazine_wct'), 'view_item' => __('View News', 'Blogazine_wct'), 'search_items' => __('Search News', 'Blogazine_wct'), 'not_found' => __('No News found', 'Blogazine_wct'), 'not_found_in_trash' => __('No News found in Trash', 'Blogazine_wct'), 'parent_item_colon' => '' ); $args = array( 'labels' => $labels, 'public' => true, 'has_archive' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => true, 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => 5, 'rewrite' => true, 'taxonomies' => array( 'post_tag', 'category'), 'supports' => array('title','editor','thumbnail', 'thumbnail') ); register_post_type('news',$args); }*/ //Start Blog themes_taxonomy /*function themes_taxonomy() { register_taxonomy( 'blog-cat', //The name of the taxonomy. Name should be in slug form (must not contain capital letters or spaces). 'themes', //post type name array( 'hierarchical' => true, 'label' => 'Blog Taxonomy', //Display name 'query_var' => true, 'rewrite' => array( 'slug' => 'themes', // This controls the base slug that will display before each term 'with_front' => false // Don't display the category base before ) ) ); } add_action( 'init', 'themes_taxonomy');*/ function filter_post_type_link($link, $post) { if ($post->post_type != 'themes') return $link; if ($cats = get_the_terms($post->ID, 'blog-cat')) $link = str_replace('%blog-cat%', array_pop($cats)->slug, $link); return $link; } add_filter('post_type_link', 'filter_post_type_link', 10, 2); //End Blog themes_taxonomy //Start Blog /*add_action('init', 'custom_post_blog'); function custom_post_blog() { $labels = array( 'name' => _x('Blog', 'post type general name', 'Blogazine_wct'), 'singular_name' => _x('Blog', 'post type singular name', 'Blogazine_wct'), 'add_new' => _x('Add New', 'Blog', 'Blogazine_wct'), 'add_new_item' => __('Add New Blog', 'Blogazine_wct'), 'edit_item' => __('Edit Blog', 'Blogazine_wct'), 'new_item' => __('New Blog', 'Blogazine_wct'), 'view_item' => __('View Blog', 'Blogazine_wct'), 'search_items' => __('Search Blog', 'Blogazine_wct'), 'not_found' => __('No Blog found', 'Blogazine_wct'), 'not_found_in_trash' => __('No Blog found in Trash', 'Blogazine_wct'), 'parent_item_colon' => '' ); $args = array( 'labels' => $labels, 'public' => true, 'has_archive' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => true, 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => 5, 'rewrite' => true, 'taxonomies' => array( 'post_tag','blog-cat'), 'supports' => array('title','editor','thumbnail', 'thumbnail') ); register_post_type('blog',$args); }*/ //End Blog ////function.php function pagination($pages = '', $range = 4) { $showitems = ($range * 2)+1; global $paged; if(empty($paged)) $paged = 1; if($pages == '') { global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages) { $pages = 1; } } if(1 != $pages) { echo "
Page ".$paged." of ".$pages.""; if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "« First"; if($paged > 1 && $showitems < $pages) echo "‹ Previous"; for ($i=1; $i <= $pages; $i++) { if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )) { echo ($paged == $i)? "".$i."":"".$i.""; } } if ($paged < $pages && $showitems < $pages) echo "Next ›"; if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "Last »"; echo "
\n"; } } function get_excerpt_by_id($post_id){ $the_post = get_post($post_id); //Gets post ID $the_excerpt = $the_post->post_content; //Gets post_content to be used as a basis for the excerpt $excerpt_length = 10; //Sets excerpt length by word count $the_excerpt = strip_tags(strip_shortcodes($the_excerpt)); //Strips tags and images $words = explode(' ', $the_excerpt, $excerpt_length + 1); if(count($words) > $excerpt_length) : array_pop($words); array_push($words, '…'); $the_excerpt = implode(' ', $words); endif; $the_excerpt = $the_excerpt; return $the_excerpt; }