Introduction to Is_singular () function in WordPress, wordpress function Manual
The function is_singular () detects that the result is true when one of the following returns true: Is_single (), Is_page (), Is_attachment (). If $post_types is specified, the type is also detected.
Function prototypes
Copy the Code code as follows:
Is_singular ($post _types = ");
Detailed parameters
$post the type _types,post type or in the current query.
return value
The detection succeeds returns TRUE, otherwise false is returned.
Application examples
Show different ads under the singular page:
Copy the Code code as follows:
<?php
if (Is_singular ()) {
Show Adv. #1
} else {
Show Adv. #2
}
?>
For normal post returns true:
Copy the Code code as follows:
Is_singular (' post ');
If Is_single (), Is_page (), and Is_attachement () return true, the following function returns true:
Copy the Code code as follows:
Is_singular ();
For the custom post type book, the following function returns true:
Copy the Code code as follows:
Is_singular (' book ');
Summarize
When using pager, navigation is not displayed at Is_singular ().
http://www.bkjia.com/PHPjc/954098.html www.bkjia.com true http://www.bkjia.com/PHPjc/954098.html techarticle WordPress in Is_singular () function Introduction, WordPress function Manual function is_singular () test result is true, when one of the following returns true: Is_single (), Is_page (), Is_ Attachment (). Like ...