admin管理员组文章数量:1130349
I have a header file in WordPress theme which always shows site title after the creation of a new page because of code <?php echo esc_html( get_bloginfo( 'name' ) ); ?> but I want it to replace with current page title instate of site name so, what would be PHP code for that?
I have a header file in WordPress theme which always shows site title after the creation of a new page because of code <?php echo esc_html( get_bloginfo( 'name' ) ); ?> but I want it to replace with current page title instate of site name so, what would be PHP code for that?
1 Answer
Reset to default -2Try below code.
global $post;
echo esc_html( get_the_title($post->ID) );
I have a header file in WordPress theme which always shows site title after the creation of a new page because of code <?php echo esc_html( get_bloginfo( 'name' ) ); ?> but I want it to replace with current page title instate of site name so, what would be PHP code for that?
I have a header file in WordPress theme which always shows site title after the creation of a new page because of code <?php echo esc_html( get_bloginfo( 'name' ) ); ?> but I want it to replace with current page title instate of site name so, what would be PHP code for that?
-
Are you referring to the
<title>tag? – Jacob Peattie Commented Nov 12, 2018 at 6:24
1 Answer
Reset to default -2Try below code.
global $post;
echo esc_html( get_the_title($post->ID) );
本文标签: What is the wordpress page title php code
版权声明:本文标题:What is the wordpress page title php code? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749191573a2330262.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


<title>tag? – Jacob Peattie Commented Nov 12, 2018 at 6:24