Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This the url format: www.mysite.com/pageone

How do I get the page name? what is the wordpress function/method for this?

bloginfo('name') return the site name. I want the function that returns (return not echo) the name of the current page.

share|improve this question
    
I am not sure what you want to get from what input. Page's title from page's URL? Page slug from something? Please write it out more clearly. –  Rarst Jan 18 '11 at 9:12
    
@Rarst: I clarified my question now –  danyentezari Jan 18 '11 at 9:16
add comment

1 Answer 1

up vote 1 down vote accepted

To display title of current page you use the_title() template tag.

Related and slightly more specific functions are:

  • get_the_title() that returns title without echoing and can retrieve title of another page/post, given its ID as input;
  • the_title_attribute() that returns a little more cleaned up version (safer to use in link titles without breaking markup and such) and takes arguments in query string format.
share|improve this answer
    
Thanks alot –  danyentezari Jan 18 '11 at 9:26
    
Or maybe even get_query_var('pagename')? –  t31os Jan 18 '11 at 16:34
    
@t31os if I am not mistaken that would be slug and not title. –  Rarst Jan 18 '11 at 16:59
    
Oh yes of course, my bad... –  t31os Jan 18 '11 at 18:08
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.