get_var("SELECT post_title FROM $wpdb->posts WHERE post_name = '$pagename'"); }else if($wp_query->query_vars['category_name']!=''){ $pgname=$wp_query->query_vars['category_name']; }else if($wp_query->query_vars['tag']!=''){ $pgname=$wp_query->query_vars['tag']; } echo get_the_title()?>