Warning: Trying to access array offset on false in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 216
in_the_loop() - 调用方是否在循环中 - WordPress函数 - WordPress动力
当前浏览:首页 / WordPress函数 / in_the_loop()

in_the_loop()

调用方是否在循环中


Warning: Undefined array key -1 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 185

Warning: Undefined array key 3 in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/reference-cat.php on line 186

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "6514ce4ad3778fc4220f1367562c322b" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "03aa60da119bb5c16ea25765dd0497ee" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

Warning: Undefined variable $searchand in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 154

Warning: Undefined array key "da3fa25e51008d111052e4f7cd1619a4" in /www/wwwroot/www.wpdongli.com/wp-content/themes/WPdongli/functions/wp.php on line 223

in 判断

loop

themore...


描述

更多类似的主题函数信息,请查看主题开发手册中的条件标签文章。


返回

(bool) 如果调用方在循环内,则为true,如果循环尚未开始或结束,则为false。



源码

查看源码 官方文档


更新日志

版本描述
2.0.0开始引入

使用示例

  • 示例1

    修改单个文章标题

    为了在函数文件中使用,此代码示例使您能够修改条目标题的默认输出。

    function wpdocs_modify_single_post_entry_titles( $title ) {
    
    	if ( is_singular( 'post' ) && in_the_loop() ) {
    		/* Modify $title */
    	}
    
    	return $title;
    }
    add_filter( 'the_title', 'wpdocs_modify_single_post_entry_titles' );