Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php wordpress默认功能不工作_Php_Wordpress - Fatal编程技术网

Php wordpress默认功能不工作

Php wordpress默认功能不工作,php,wordpress,Php,Wordpress,我已经创建了一个子wordpress主题,但我不知道在某些情况下wordpress函数不起作用的原因是什么:1。像在functions.php上一样->是单数('post\u type')不返回true,即使我在那篇post\u type文章上,是用户登录的()在我创建的几页模板上不返回true我认为在使用wp\u查询时必须调用它。我猜您在调用这些函数之前没有使用wp_查询。这是核心wordpress功能的实现 function is_singular( $post_types = '' ) {

我已经创建了一个子wordpress主题,但我不知道在某些情况下wordpress函数不起作用的原因是什么:
1。像在functions.php上一样->
是单数('post\u type')
不返回true,即使我在那篇post\u type文章上,
是用户登录的()
在我创建的几页模板上不返回true

我认为在使用wp\u查询时必须调用它。我猜您在调用这些函数之前没有使用wp_查询。这是核心wordpress功能的实现

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 );
}

您应该在配置文件中激活WP_DEBUG以获取更具体的错误消息。