'
',
'after_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => __( 'Language Picker'),
'id' => 'wpml',
'before_widget' => '',
'after_widget' => '',
));
register_sidebar(array(
'name' => __( 'Inner Pages Widgets'),
'id' => 'inner',
'before_widget' => '',
'after_widget' => '',
));
register_sidebar(array(
'name' => __( 'Copyright Widgets'),
'id' => 'copyright',
'before_widget' => '',
'after_widget' => '',
));
}
add_custom_background();
register_post_type('profile', array(
'label' => __('Profiles'),
'singular_label' => __('Profile'),
'public' => true,
'show_ui' => false, // UI in admin panel
'capability_type' => 'post',
'hierarchical' => true,
'rewrite' => array("slug" => "user-profile"), // Permalinks format
'supports' => array('title', 'editor','page-attributes','author')
));
add_action("template_redirect", 'my_template_redirect');
// Template selection
function my_template_redirect()
{
global $wp;
global $wp_query;
if (isset($_REQUEST['post_type']))
{
if ($_REQUEST['post_type']=="signup")
{
// Let's look for the register.php template file in the current theme
if (have_posts())
{
include(TEMPLATEPATH . '/register.php');
die();
}
else
{
$wp_query->is_404 = true;
}
}else if ($_REQUEST['post_type']=="user-profile")
{
// Let's look for the viewprofile.php template file in the current theme
//http://kovshenin.com/2010/extending-custom-post-types-in-wordpress-3-0/
//if (have_posts())
//{
include(TEMPLATEPATH . '/viewprofile.php');
// die();
//}
//else
//{
// $wp_query->is_404 = true;
//}
}
}
}
add_theme_support('post-thumbnails');
add_filter( 'show_admin_bar', '__return_false' );
function yoast_hide_admin_bar_settings() {
?>
'."\n";
echo ''."\n\n";
}
/********************************************************************
Image Uploader Necessary Scripts
*********************************************************************/
function my_upload_scripts() {
wp_enqueue_script('media-upload');
}
add_action('admin_print_scripts', 'my_upload_scripts');
/********************************************************************
Profile Image Upload Field Code
*********************************************************************/
require_once( STYLESHEETPATH . '/img_upload_resize_crop.php' );
add_action( 'init', 'custom_img_uploader' );
function custom_img_uploader () {
global $profilePicture;
if (isset($_FILES['profilePicture']['name'])!= "" ) {
if ( $_FILES['profilePicture']['name']!="" ) {
$your_image = new _image;
$upload_dir = wp_upload_dir();
//To Upload
$your_image->uploadTo = $upload_dir['basedir'].'/';
$upload = $your_image->upload($_FILES['profilePicture']);
//To Resize
$your_image->newPath = $upload_dir['basedir'].'/thumbs/';
$your_image->newWidth = 150;
$your_image->newHeight = 200;
$resized = $your_image->resize();
$profilePicture=str_replace($upload_dir['basedir'].'/thumbs/', "", $resized );
unlink($upload);
}else{
$profilePicture='';
}
}
}
/***********************************************************************
EXTRA PROFILE FIELDS
http://bavotasan.com/2009/adding-extra-fields-to-the-wordpress-user-profile/
************************************************************************/
function extra_user_profile_fields( $user ) {
//global $profilePicture;
?>