简体   繁体   English

如何在Wordpress中获取页面名称

[英]How to get page name in wordpress

How to get the current page name in wordpress.Here is example http://ww.example.com/media/ . 如何在wordpress中获取当前页面名称,例如http://ww.example.com/media/ How do we get the font_page.php.Please help me. 我们如何获得font_page.php。请帮助我。

$page_data = get_page($postid);
echo $page_data->post_title;

The above example displays title of page.we need the font_page.php.How can we get this. 上面的例子显示了page的标题,我们需要font_page.php,如何获得它。

I think you are trying to get the file name of your template file. 我认为您正在尝试获取模板文件的文件名。 You may use get_page_template() for get the template file name: 您可以使用get_page_template()获取模板文件名:

echo basename( get_page_template() );

//it will return your template file name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM