<?php



//theme options 



require_once ( get_stylesheet_directory() . '/theme-options.php' );







// This theme uses wp_nav_menu() in one location.



	register_nav_menus( array(



		'main' => __( 'Top Menu', ' ' ),	



		'menu' => __( 'Main Menu', ' ' ),	



		



	) );







add_theme_support('post-thumbnails');



get_option('thumbnail_crop');



add_image_size('blog-image', 610, 280, true);

add_image_size('paypal_image', 36, 19, true);

add_image_size('feature_image', 60, 60, true);



add_image_size('testimonial_image',171, 112, true);



add_image_size('gallery_image', 50, 50, true);



add_image_size('gallery2_image', 125,125, true);



add_image_size('slider_image', 498, 315, true);		







add_action('init', 'paypal');  



function paypal() {  

   $labels = array(

		'name' => _x('Paypal', 'post type general name'),

		'singular_name' => _x('Paypal', 'post type singular name'),

		'add_new' => _x('Add New paypal', 'portfolio item'),

		'add_new_item' => __('Add New paypal'),

		'edit_item' => __('Edit paypal'),

		'new_item' => __('New paypal'),

		'view_item' => __('View paypal'),

		'search_items' => __('Search paypal'),

		'not_found' =>  __('Nothing found'),

		'not_found_in_trash' => __('Nothing found in Trash'),

		'parent_item_colon' => ''

	);

 

	$args = array(

		'labels' => $labels,

		'public' => true,

		'publicly_queryable' => true,

		'show_ui' => true,

		'query_var' => true,		

		'rewrite' => true,

		'capability_type' => 'post',

		'hierarchical' => false,

		'menu_position' => 05,

		'supports' => array('title','editor','thumbnail')

	  ); 

 

	register_post_type( 'paypal' , $args );

}



add_action('init', 'feature');  



function feature() {  

   $labels = array(

		'name' => _x('Feature', 'post type general name'),

		'singular_name' => _x('Feature', 'post type singular name'),

		'add_new' => _x('Add New feature', 'portfolio item'),

		'add_new_item' => __('Add New feature'),

		'edit_item' => __('Edit feature'),

		'new_item' => __('New feature'),

		'view_item' => __('View feature'),

		'search_items' => __('Search feature'),

		'not_found' =>  __('Nothing found'),

		'not_found_in_trash' => __('Nothing found in Trash'),

		'parent_item_colon' => ''

	);

 

	$args = array(

		'labels' => $labels,

		'public' => true,

		'publicly_queryable' => true,

		'show_ui' => true,

		'query_var' => true,		

		'rewrite' => true,

		'capability_type' => 'post',

		'hierarchical' => false,

		'menu_position' => 05,

		'supports' => array('title','editor','thumbnail')

	  ); 

 

	register_post_type( 'feature' , $args );

}





/*************************** featured_banner Admin Menu ***************************/



add_action('init', 'services');  







function services() {  



   $labels = array(



		'name' => _x('Services', 'post type general name'),



		'singular_name' => _x('Services', 'post type singular name'),



		'add_new' => _x('Add New services', 'portfolio item'),



		'add_new_item' => __('Add New services'),



		'edit_item' => __('Edit services'),



		'new_item' => __('New services'),



		'view_item' => __('View services'),



		'search_items' => __('Search services'),



		'not_found' =>  __('Nothing found'),



		'not_found_in_trash' => __('Nothing found in Trash'),



		'parent_item_colon' => ''



	);



 



	$args = array(



		'labels' => $labels,



		'public' => true,



		'publicly_queryable' => true,



		'show_ui' => true,



		'query_var' => true,		



		'rewrite' => true,



		'capability_type' => 'post',



		'hierarchical' => false,



		'menu_position' => 05,



		'supports' => array('title','editor','thumbnail')



	  ); 



 



	register_post_type( 'services' , $args );



}







/*************************** featured_banner Admin Menu ***************************/



add_action('init', 'testimonial2');  







function testimonial2() {  



   $labels = array(



		'name' => _x('Testimonial', 'post type general name'),



		'singular_name' => _x('Testimonial', 'post type singular name'),



		'add_new' => _x('Add New testimonial2', 'portfolio item'),



		'add_new_item' => __('Add New testimonial2'),



		'edit_item' => __('Edit testimonial2'),



		'new_item' => __('New testimonial2'),



		'view_item' => __('View testimonial2'),



		'search_items' => __('Search testimonial2'),



		'not_found' =>  __('Nothing found'),



		'not_found_in_trash' => __('Nothing found in Trash'),



		'parent_item_colon' => ''



	);



 



	$args = array(



		'labels' => $labels,



		'public' => true,



		'publicly_queryable' => true,



		'show_ui' => true,



		'query_var' => true,		



		'rewrite' => true,



		'capability_type' => 'post',



		'hierarchical' => false,



		'menu_position' => 05,



		'supports' => array('title','editor','thumbnail')



	  ); 



 



	register_post_type( 'testimonial2' , $args );



}











add_action('init', 'slider');  







function slider() {  



   $labels = array(



		'name' => _x('Slider', 'post type general name'),



		'singular_name' => _x('Slider', 'post type singular name'),



		'add_new' => _x('Add New slider', 'portfolio item'),



		'add_new_item' => __('Add New slider'),



		'edit_item' => __('Edit slider'),



		'new_item' => __('New slider'),



		'view_item' => __('View slider'),



		'search_items' => __('Search slider'),



		'not_found' =>  __('Nothing found'),



		'not_found_in_trash' => __('Nothing found in Trash'),



		'parent_item_colon' => ''



	);



 



	$args = array(



		'labels' => $labels,



		'public' => true,



		'publicly_queryable' => true,



		'show_ui' => true,



		'query_var' => true,		



		'rewrite' => true,



		'capability_type' => 'post',



		'hierarchical' => false,



		'menu_position' => 05,



		'supports' => array('title','editor','thumbnail')



	  ); 



 



	register_post_type( 'slider' , $args );



}







add_action('init', 'gallery');  







function gallery() {  



   $labels = array(



		'name' => _x('Gallery', 'post type general name'),



		'singular_name' => _x('Gallery', 'post type singular name'),



		'add_new' => _x('Add New gallery', 'portfolio item'),



		'add_new_item' => __('Add New gallery'),



		'edit_item' => __('Edit gallery'),



		'new_item' => __('New gallery'),



		'view_item' => __('View gallery'),



		'search_items' => __('Search gallery'),



		'not_found' =>  __('Nothing found'),



		'not_found_in_trash' => __('Nothing found in Trash'),



		'parent_item_colon' => ''



	);



 



	$args = array(



		'labels' => $labels,



		'public' => true,



		'publicly_queryable' => true,



		'show_ui' => true,



		'query_var' => true,		



		'rewrite' => true,



		'capability_type' => 'post',



		'hierarchical' => false,



		'menu_position' => 05,



		'supports' => array('title','editor','thumbnail')



	  ); 



 



	register_post_type( 'gallery' , $args );



}











add_action('init', 'gallery2');  







function gallery2() {  



   $labels = array(



		'name' => _x('Sponsors', 'post type general name'),



		'singular_name' => _x('Sponsors', 'post type singular name'),



		'add_new' => _x('Add New sponsors', 'portfolio item'),



		'add_new_item' => __('Add New sponsors'),



		'edit_item' => __('Edit sponsors'),



		'new_item' => __('New sponsors'),



		'view_item' => __('View sponsors'),



		'search_items' => __('Search sponsors'),



		'not_found' =>  __('Nothing found'),



		'not_found_in_trash' => __('Nothing found in Trash'),



		'parent_item_colon' => ''



	);



 



	$args = array(



		'labels' => $labels,



		'public' => true,



		'publicly_queryable' => true,



		'show_ui' => true,



		'query_var' => true,		



		'rewrite' => true,



		'capability_type' => 'post',



		'hierarchical' => false,



		'menu_position' => 05,



		'supports' => array('title','editor','thumbnail')



	  ); 



 



	register_post_type( 'gallery2' , $args );



}



	



//Content Limit



function the_content_limit($max_char, $stripteaser = 0, $more_file = '') {



   $content = get_the_content($more_link_text, $stripteaser, $more_file);



   $content = apply_filters('the_content', $content);



   $content = str_replace(']]>', ']]&gt;', $content);



       $content = strip_tags($content);        



          if (strlen($_GET['p']) > 0) {



                 echo $content;



          }



          else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {



                       $content = substr($content, 0, $espacio);



                       $content = $content;



                       echo $content;



          }



          else {



                 echo $content;



          }



       }







// Declare sidebar widget zone



    if (function_exists('register_sidebar')) {



	register_sidebar(array(



    		'name' => 'Sidebar',



    		'description'   => 'These are widgets for the sidebar.',



    		'before_widget' => '<div class="side">',



    		'after_widget'  => '</div>',



    		'before_title'  => '<h2>',



    		'after_title'   => '</h2>'



    	));



		



	register_sidebar(array(



    		'name' => 'Page sidebar',



    		'description'   => 'These are widgets for the sidebar.',



    		'before_widget' => '<div class="side1">',



    		'after_widget'  => '</div>',



    		'before_title'  => '<h2>',



    		'after_title'   => '</h2>'



    	));







	register_sidebar(array(



    		'name' => 'Contact sidebar',



    		'description'   => 'These are widgets for the sidebar.',



    		'before_widget' => '<div class="side1">',



    		'after_widget'  => '</div>',



    		'before_title'  => '<h2>',



    		'after_title'   => '</h2>'



    	));











	register_sidebar(array(



    		'name' => 'Footer sidebar',



    		'description'   => 'These are widgets for the sidebar.',



    		'before_widget' => '<div class="">',



    		'after_widget'  => '</div>',



    		'before_title'  => '<h2>',



    		'after_title'   => '</h2>'



    	));







	register_sidebar(array(



    		'name' => 'Footer sidebar2',



    		'description'   => 'These are widgets for the sidebar.',







    		'before_widget' => '<div class="ftr-box1">',



    		'after_widget'  => '</div>',



    		'before_title'  => '<h2>',



    		'after_title'   => '</h2>'



    	));





		register_sidebar(array(



    		'name' => 'Footer sidebar3',



    		'description'   => 'These are widgets for the sidebar.',



    		'before_widget' => '<div class="ftr-box3">',



    		'after_widget'  => '</div>',



    		'before_title'  => '<h2>',



    		'after_title'   => '</h2>'



    	));



	}



	



	



	



if( function_exists ('wp_register_sidebar_widget'))



{



wp_register_sidebar_widget('social','social', 'social', array('description' => 'This widget is for Social icons'));



}







function social() {



 ?>



         <?php global $NHP_Options; ?>



  <span class="ftr-social">



    	<ul>



                	<?php if($NHP_Options->get('333') !=''){?>



					<li><a href="<?php echo $NHP_Options->get('333'); ?>"><img src="<?php bloginfo('template_url');?>/images/face.png" alt="" /></a></li>



<?php }?>



					<?php if($NHP_Options->get('334') !=''){?>



                    <li><a href="<?php echo $NHP_Options->get('334'); ?>"><img src="<?php bloginfo('template_url');?>/images/twiter.png"  alt="" /></a></li>



                    <?php }?>



                    <?php if($NHP_Options->get('335') !=''){?>



                    <li><a href="<?php echo $NHP_Options->get('335'); ?>"><img src="<?php bloginfo('template_url');?>/images/in.png" alt="" /></a></li><?php }?>



                    <?php if($NHP_Options->get('336') !=''){?>



                    <li><a href="<?php echo $NHP_Options->get('336'); ?>"><img src="<?php bloginfo('template_url');?>/images/digg.png"  alt="" /></a></li><?php }?>



                    <?php if($NHP_Options->get('337') !=''){?>



                    <li><a href="<?php echo $NHP_Options->get('337'); ?>"><img src="<?php bloginfo('template_url');?>/images/stumb.png"  alt="" /></a></li><?php }?>



                    <?php if($NHP_Options->get('338') !=''){?>



                    <li><a href="<?php echo $NHP_Options->get('338'); ?>"><img src="<?php bloginfo('template_url');?>/images/clouds.png" alt="" /></a></li>



                  <?php }?>



                  



                    <li><a href="<?php bloginfo('rss_url'); ?>"><img src="<?php bloginfo('template_url');?>/images/rss.png" alt="" /></a></li>



                    



                 



                    <li><a href="<?php echo $NHP_Options->get('339'); ?>"><img src="<?php bloginfo('template_url');?>/images/myspace.png" alt="" /></a></li>



                    



                    <br />



                   



                    <li><a href="<?php echo $NHP_Options->get('340'); ?>"><img src="<?php bloginfo('template_url');?>/images/p.png"  alt="" /></a></li>



                    



                    <?php if($NHP_Options->get('341') !=''){?>



                    <li><a href="<?php echo $NHP_Options->get('341'); ?>"><img src="<?php bloginfo('template_url');?>/images/sqplus.png"  alt="" /></a></li><?php }?>



                    <?php if($NHP_Options->get('342') !=''){?>



                    <li><a href="<?php echo $NHP_Options->get('342'); ?>"><img src="<?php bloginfo('template_url');?>/images/tube.png"  alt="" /></a></li><?php }?>



                </ul>



      </span>



            



    



 







 <?php



	}	



	if( function_exists ('wp_register_sidebar_widget'))



	{



wp_register_sidebar_widget('images','images', 'images', array('description' => 'This widget is for Gallery images'));



}







function images() {



 ?>



         <?php global $NHP_Options; ?>



 <div class="ftr-box2">



<h2>Gallery </h2>







            <?php $args = array('post_type' => 'gallery','showposts' => '6');







		$the_query = null;







		$the_query = new WP_Query($args); ?>







		 <?php if($the_query->have_posts()):?>







          <?php while($the_query->have_posts()) : $the_query->the_post();?> 







            <span class="ftr-frame1"><a href="http://wpsocialpress.com/gallery/"><?php the_post_thumbnail('gallery_image'); ?></a></span>







             <?php endwhile; ?>







                   <?php else:?>







            <span class="ftr-frame1"><a href="http://wpsocialpress.com/gallery/"><img src="<?php bloginfo('template_url');?>/images/ftr-img.png"  alt="" /></a></span>







	 		<span class="ftr-frame1"><a href="http://wpsocialpress.com/gallery/"><img src="<?php bloginfo('template_url');?>/images/ftr-img.png"  alt="" /></a></span>







            <span class="ftr-frame1"><a href="http://wpsocialpress.com/gallery/"><img src="<?php bloginfo('template_url');?>/images/ftr-img.png"  alt="" /></a></span>







            <span class="ftr-frame1"><a href="http:http://wpsocialpress.com/gallery/"><img src="<?php bloginfo('template_url');?>/images/ftr-img.png"  alt="" /></a></span>







            <span class="ftr-frame1"><a href="http://wpsocialpress.com/gallery/"><img src="<?php bloginfo('template_url');?>/images/ftr-img.png"  alt="" /></a></span>







            <span class="ftr-frame1"><a href="http://wpsocialpress.com/gallery/"><img src="<?php bloginfo('template_url');?>/images/ftr-img.png"  alt="" /></a></span>



</div>



 <?php endif; ?> 







     



       <?php



	}	



//////////////////// Custom Input //////////////////

add_action("admin_init", "admin_init");

add_action('save_post', 'save_paypal_option');

 

function admin_init(){

add_meta_box("paypal_logo_meta", "Paypal Option", "paypal_logo_meta_options", "paypal", "normal", "high");

}





// Credit Text Box

function paypal_logo_meta_options()

{

global $post;

$custom = get_post_custom($post->ID);

$sub_title = $custom["sub_title"][0];



?>

<div class="credit_l">

<label style=" margin-right:49px;  width:150px; " class="name">Link :</label>

<input name="sub_title" style="margin:10px 10px 1px 65px;" value="<?php echo $sub_title; ?>" />



</div>

<?php

}



function save_paypal_option()

{

global $post;

update_post_meta($post->ID, "sub_title", $_POST["sub_title"]);

}	////////////////////END Custom Input //////////////////	

	

	



// Custom Short Title Function



function the_short_title($before = '', $after = '', $echo = true, $length = false) {



$title = get_the_title();







if ( $length && is_numeric($length) ) {



$title = substr( $title, 0, $length );



}







if ( strlen($title)> 0 ) {



$title = apply_filters('the_short_title', $before . $title . $after, $before, $after);



if ( $echo )



echo $title;



else



return $title;



}



}







function show_posts_nav() {



global $wp_query;



return ($wp_query->max_num_pages > 1);



}







function kriesi_pagination($pages = '', $range = 2)



{



$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 "<div class='pagination'>";



if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>&laquo;</a>";



if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>&lsaquo;</a>";







for ($i=1; $i <= $pages; $i++)



{



if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))



{



echo ($paged == $i)? "<span class='pagination_botton'>".$i."</span>":"<a href='".get_pagenum_link($i)."' class='inactive' >".$i."</a>";



}



}







if ($paged < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($paged + 1)."'>&rsaquo;</a>";



if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>&raquo;</a>";



echo "</div>\n";



}



}			



?>