for posts and comments. add_theme_support( 'automatic-feed-links' ); load_plugin_textdomain( $domain, $path_from_abspath, $path_from_plugins_folder ); load_theme_textdomain('bangasd'); /* * This theme supports custom background color and image, and here * we also set up the default background color. */ add_theme_support( 'custom-background', array( 'default-color' => 'e6e6e6', ) ); add_theme_support( 'custom-header', array( 'default-color' => 'e6e6e6', ) ); /* * Let WordPress manage the document title. */ add_theme_support( 'title-tag' ); // Your changeable header business starts here define( 'HEADER_TEXTCOLOR', '' ); // No CSS, just IMG call. The %s is a placeholder for the theme template directory URI. define( 'HEADER_IMAGE', '%s/images/path.jpg' ); // The height and width of your custom header. You can hook into the theme's own filters to change these values. // Add a filter to chandpur_header_image_width and chandpur_header_image_height to change these values. define( 'HEADER_IMAGE_WIDTH', apply_filters( 'chandpur_header_image_width', 980 ) ); define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'chandpur_header_image_height', 340 ) ); // We'll be using post thumbnails for custom header images on posts and pages. // We want them to be 560 pixels wide by 180 pixels tall. // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); // Don't support text inside the header image. define( 'NO_HEADER_TEXT', true ); /* * Makes Chandpur available for translation. * * Translations can be added to the /languages/ directory. * If you're building a theme based on Twenty Twelve, use a find and replace * to change 'twentytwelve' to the name of your theme in all the template files. */ add_action('after_setup_theme', 'crucial_setup'); function crucial_setup(){ load_theme_textdomain( 'bangasd', get_template_directory() . '/languages' ); } // This theme styles the visual editor with editor-style.css to match the theme style. add_editor_style(); /* Register comment Support */ function comment_scripts(){ if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); } /* This code for Featured Image Support */ add_theme_support( 'post-thumbnails', array( 'post' ) ); set_post_thumbnail_size( 200, 200, true ); add_image_size( 'post-image', 150, 150, true ); /* This code for readmore */ function excerpt($num) { $limit = $num+1; $excerpt = explode(' ', get_the_excerpt(), $limit); array_pop($excerpt); $excerpt = implode(" ",$excerpt)." Read More"; echo $excerpt; } function my_more_link($more_link, $more_link_text) { return str_replace($more_link_text, 'Keep reading this post', $more_link); } add_filter('the_content_more_link', 'my_more_link', 10, 2); // Add all CSS Files function my_css_calling(){ wp_enqueue_style( 'ali-style', get_stylesheet_uri() ); wp_register_style('slicknav', get_template_directory_uri().'/css/slicknav.css', array(), '1.0.0', 'all' ); wp_register_style('custom', get_template_directory_uri().'/css/custom.css', array(), '2.0.0', 'all' ); wp_register_style('responsive', get_template_directory_uri().'/css/responsive.css', array(), '2.0.0', 'all' ); wp_enqueue_style('slicknav'); wp_enqueue_style('custom'); wp_enqueue_style('responsive'); // Add all jQuery Files wp_enqueue_script('jquery'); wp_enqueue_script('selectnav.min', get_template_directory_uri() .'/js/selectnav.min.js', array(), '1.0.0', 'true' ); wp_enqueue_script('plugins', get_template_directory_uri() .'/js/plugins.js', array(), '2.0.0', 'true' ); wp_enqueue_script('easing', get_template_directory_uri() .'/js/lib/jquery.easing.min.js', array(), '1.0.0', 'true' ); wp_enqueue_script('jquery.easing', get_template_directory_uri() .'/js/jquery.easing.1.3.js', array(), '1.0.0', 'true' ); wp_enqueue_script('jquery.skitter.min', get_template_directory_uri() .'/js/jquery.skitter.min.js', array(), '1.0.0', 'true' ); wp_enqueue_script('scrollUp', get_template_directory_uri() .'/js/jquery.scrollUp.min.js', array(), '1.0.0', 'true' ); wp_enqueue_script('main', get_template_directory_uri() .'/js/main.js', array(), '2.0.0', 'true' ); } add_action('wp_enqueue_scripts', 'my_css_calling'); // Switches 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' ) ); add_action('init', 'wpj_register_menu'); function wpj_register_menu() { if (function_exists('register_nav_menu')) { register_nav_menu( 'wpj-main-menu', __( 'Bangasd Menu', 'alihossain' ) ); } } function wpj_default_menu() { echo ''; } /** * Registers two widget areas. * * @since Bangasd 1.0 * * @return void */ function twentythirteen_widgets_init() { register_sidebar( array( 'name' => __( 'Main Widget Area', 'bangasd' ), 'id' => 'sidebar-1', 'description' => __( 'Appears in the Main Widget Area section of the site.', 'bangasd' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer One Widget Area', 'bangasd' ), 'id' => 'sidebar-2', 'description' => __( 'Appears on posts and pages in the sidebar.', 'bangasd' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Two Widget Area', 'bangasd' ), 'id' => 'sidebar-3', 'description' => __( 'Appears on posts and pages in the sidebar.', 'bangasd' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer Three Widget Area', 'bangasd' ), 'id' => 'sidebar-4', 'description' => __( 'Appears on posts and pages in the sidebar.', 'bangasd' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'twentythirteen_widgets_init' ); //---------------------------- [ Pagenavi Function ] ------------------------------// function magazine_pagenavi() { global $wp_query, $wp_rewrite; $pages = ''; $max = $wp_query->max_num_pages; if (!$current = get_query_var('paged')) $current = 1; $args['base'] = str_replace(999999999, '%#%', get_pagenum_link(999999999)); $args['total'] = $max; $args['current'] = $current; $total = 1; $args['mid_size'] = 3; $args['end_size'] = 1; $args['prev_text'] = '« Prev'; $args['next_text'] = 'Next »'; if ($max > 1) echo '
'; if ($total == 1 && $max > 1) $pages = 'Page ' . $current . ' of ' . $max . ''; echo $pages . paginate_links($args); if ($max > 1) echo '
';
}


//---------------------------- [ Theme Option ] ------------------------------//
$themename = "Bangasd";
$shortname = str_replace(' ', '_', strtolower($themename));
function get_theme_option($option)
{
	global $shortname;
	return stripslashes(get_option($shortname . '_' . $option));
}
function get_theme_settings($option)
{
	return stripslashes(get_option($option));
}
function cats_to_select()
{
	$categories = get_categories('hide_empty=0'); 
	$categories_array[] = array('value'=>'0', 'title'=>'Select');
	foreach ($categories as $cat) {
		if($cat->category_count == '0') {
			$posts_title = 'No posts!';
		} elseif($cat->category_count == '1') {
			$posts_title = '1 post';
		} else {
			$posts_title = $cat->category_count . ' posts';
		}
		$categories_array[] = array('value'=> $cat->cat_ID, 'title'=> $cat->cat_name . ' ( ' . $posts_title . ' )');
	  }
	return $categories_array;
}
$options = array (
	array(	"type" => "open"),
			array(	"name" => "Logo Image URL",
				"desc" => "Enter the logo image full path. Logo sixe 300x100px. Leave it blank if you don't want to use logo image.",
				"id" => $shortname."_logo",
				"std" =>  get_template_directory_uri()  . "/images/logo.png",
				"type" => "text"),		        
         array(	"name" => "Twitter",
			"desc" => "Enter your twitter account url here.",
			"id" => $shortname."_twitter",
			"std" => "http://twitter.com/shovo852",
			"type" => "text"),
		array(	"name" => "Twitter Text",
			"desc" => "",
			"id" => $shortname."_twittertext",
			"std" => "Follow me!",
			"type" => "text"),	
         array(	"name" => "Facebook",
			"desc" => "Enter your Facebook account url here.",
			"id" => $shortname."_facebook",
			"std" => "http://facebook.com/alibd654",
			"type" => "text"),
		array(	"name" => "Facebook Text",
			"desc" => "",
			"id" => $shortname."_facebooktext",
			"std" => "Follow me!",
			"type" => "text"),
		array(	"name" => "Google+",
			"desc" => "Enter your Google+ account url here.",
			"id" => $shortname."_google",
			"std" => "https://plus.google.com/u/0/109265016338820071821/posts",
			"type" => "text"),
		array(	"name" => "Google+ Text",
			"desc" => "",
			"id" => $shortname."_googletext",
			"std" => "Follow me!",
			"type" => "text"),
	   array(	"name" => "LinkeDin",
			"desc" => "Enter your LinkeDin account url here.",
			"id" => $shortname."_linkedin",
			"std" => "http://lnkd.in/UK5G2g",
			"type" => "text"),
		array(	"name" => "LinkeDin Text",
			"desc" => "",
			"id" => $shortname."_linkedintext",
			"std" => "Follow me!",
			"type" => "text"),			  
	array(	"name" => "Head Scrip(s)",
		"desc" => "The content of this box will be added immediately before </head> tag. Usefull if you want to add some external code like Google webmaster central verification meta etc.",
        "id" => $shortname."_head",
        "type" => "textarea"	
		),				
	array(	"type" => "close")
);
function mytheme_add_admin() {
global $themename, $shortname, $options;
    if ( $_GET['page'] == basename(__FILE__) ) {
        if ( 'save' == $_REQUEST['action'] ) {
                foreach ($options as $value) {
                    update_option( $value['id'], $_REQUEST[ $value['id'] ] ); }
                foreach ($options as $value) {
                    if( isset( $_REQUEST[ $value['id'] ] ) ) { update_option( $value['id'], $_REQUEST[ $value['id'] ]  ); } else { delete_option( $value['id'] ); } }
                echo '';
                die;
        } 
    }
    add_theme_page($themename." Options", "".$themename." Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');
}
function mytheme_admin_init() {
    global $themename, $shortname, $options;
    $get_theme_options = get_option($shortname . '_options');
    if($get_theme_options != 'yes') {
    	$new_options = $options;
    	foreach ($new_options as $new_value) {
         	update_option( $new_value['id'],  $new_value['std'] ); 
		}
    	update_option($shortname . '_options', 'yes');
    }
}
if(!function_exists('get_sidebars')) {
	function get_sidebars($args='')
	{
		wp_initialize_the_theme_load();
		 get_sidebar($args);
	}
}   
function mytheme_admin() {
    global $themename, $shortname, $options;
    if ( $_REQUEST['saved'] ) echo '

'.$themename.' settings saved.

'; ?>

settings

Leave blank any field if you don't want it to be shown/displayed.

         } ?> />   

\n"; } } } } //---------------------------- [ End of Theme Option ] ------------------------------// wp_link_pages( $args ); ?>