Switch language

wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren




is_singular [ WordPress Function ]

is_singular ( $post_types = '' )
Parameter:
  • (mixed) $post_types Optional. Post Type or array of Post Types
Nutzt:
  • $wp_query
Siehe:
Gibt zurück:
  • (bool)
Definiert in:

Ähnliche Funktionen: is_single, is_search, is_ssl, is_main_query, is_year


Is the query for a single post of any post type (post, attachment, page, ... )?

If the $post_types parameter is specified, this function will additionally check if the query is for one of the Posts Types specified.

Source


<?php
function is_singular$post_types '' ) {
    global 
$wp_query;

    if ( ! isset( 
$wp_query ) ) {
        
_doing_it_wrong__FUNCTION____'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
        return 
false;
    }

    return 
$wp_query->is_singular$post_types );
}
?>

Beispiele [ wp-snippets.com ]

Top Google Suchergebnisse

Mehr ...

0 Nutzerkommentare

Noch keine. Sei der Erste!

Neu hinzufügen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics