Php WordPress用于检测已加载页面的功能?
有没有wordpress功能可以用来检测页面?下面是我想做的例子Php WordPress用于检测已加载页面的功能?,php,wordpress,Php,Wordpress,有没有wordpress功能可以用来检测页面?下面是我想做的例子 <?php if( is_FUNCTION_page('Contact Us') ) : ?> ...display this <div> / xhtml <?php else: ?> something else <div> <?php endif;?> …显示此/xhtml 别的 检查功能: is_page(); // When any single P
<?php if( is_FUNCTION_page('Contact Us') ) : ?>
...display this <div> / xhtml
<?php else: ?>
something else <div>
<?php endif;?>
…显示此/xhtml
别的
检查功能:
is_page();
// When any single Page is being displayed.
is_page(42);
// When Page 42 (ID) is being displayed.
is_page('Contact');
// When the Page with a post_title of "Contact" is being displayed.
is_page('about-me');
// When the Page with a post_name (slug) of "about-me" is being displayed.
is_page(array(42,'about-me','Contact'));
// Returns true when the Pages displayed is either post ID 42, or post_name "about-me", or post_title "Contact". Note: the array ability was added at Version 2.5.
检查功能:
is_page();
// When any single Page is being displayed.
is_page(42);
// When Page 42 (ID) is being displayed.
is_page('Contact');
// When the Page with a post_title of "Contact" is being displayed.
is_page('about-me');
// When the Page with a post_name (slug) of "about-me" is being displayed.
is_page(array(42,'about-me','Contact'));
// Returns true when the Pages displayed is either post ID 42, or post_name "about-me", or post_title "Contact". Note: the array ability was added at Version 2.5.
嗯。使用Wordpress函数来实现这一点
例如:
<?php if( is_page('Contact Us') ) : ?>
<div> Your If content goes here </div>
<?php else: ?>
<div> something else </div>
<?php endif;?>
如果你的内容在这里
别的
注意:
不能在循环内使用
由于在循环过程中某些全局变量被覆盖,因此页面()将不起作用。为了在循环后使用它,必须在循环后调用wp\u reset\u query()。是的。使用Wordpress函数来实现这一点
例如:
<?php if( is_page('Contact Us') ) : ?>
<div> Your If content goes here </div>
<?php else: ?>
<div> something else </div>
<?php endif;?>
如果你的内容在这里
别的
注意:
不能在循环内使用
由于在循环过程中某些全局变量被覆盖,因此页面()将不起作用。为了在循环后使用它,必须在循环后调用wp_reset_query()