nosmalldreams
Member
Posted 1 year ago #
I'm trying to build a theme from scratch. When I navigate to a page (not a category - a page), then I want to display the name of the current page on the screen. The get_page method (http://codex.wordpress.org/Function_Reference/get_page) seems to require the id of the current page, but I don't know how to find out that id. Advice?
Thanks!
Go to WP Dasboard, click on Pages > Edit Pages. Now after that you'll see the list of all pages you have on your site. Just mouseover the title and you'll see the page ID.
Example for default About page the ID will look something like this:
/wp-admin/post.php?post=2&action=edit
The number 2 after the post= is the page ID number.
When I navigate to a page (not a category - a page), then I want to display the name of the current page on the screen.
depends on where you want to show the page title, but still give the_title() a try;
you should be able to get the page id with $post->ID
nosmalldreams
Member
Posted 1 year ago #
the_title() did it for me. Many thanks!