WordPress in Is_singular () function Introduction, wordpress function Manual _php Tutorial

Source: Internet
Author: User

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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.