To get the current page name in WordPress, you can use the wp_title
function.
Here’s an example of how you can use the wp_title
function to display the current page name:
<?php echo wp_title(); ?>
This will display the current page name in the WordPress site.
You can also use the the_title
function to display the current page name:
<?php the_title(); ?>
This will also display the current page name in the WordPress site.
Keep in mind that these functions will only work within the loop on a WordPress page or post. If you need to get the page name outside of the loop, you can use the get_the_title
function:
<?php echo get_the_title(get_the_ID()); ?>
This will get the page ID using the get_the_ID
function, and then get the page title using the get_the_title
function.