Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/251.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_Wordpress Theming - Fatal编程技术网

Php 如何在Wordpress中获取页面长度?

Php 如何在Wordpress中获取页面长度?,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,我刚开始做一些Wordpress主题编码 我想在我的主题中集成一个功能,它根据我的页面条目(内容)的长度集成另一个元素 这个想法是说 if( div with content >= 310 px ) { <div id=""> </div> } if(带内容的div>=310 px){ } 有办法吗 谢谢你的帮助 如果你有,你可以用 $('#div_to_check').height(); 还是整个文件 $(document).height();

我刚开始做一些Wordpress主题编码

我想在我的主题中集成一个功能,它根据我的页面条目(内容)的长度集成另一个元素

这个想法是说

if( div with content >= 310 px ) {
  <div id="">
  </div>
}
if(带内容的div>=310 px){
}
有办法吗

谢谢你的帮助

如果你有,你可以用

$('#div_to_check').height(); 
还是整个文件

$(document).height();
近似

<script> 
    if( $('#div_to_check').height() >= 310) {    
        document.write('<div id=""></div>');
    }
</script>

如果($('#div_to_check').height()>=310{
文件。写(“”);
}
因为页面的内容很可能是可变的,所以在页面完成加载后需要检查高度,所以我肯定会通过Javascript来完成这项工作,而不是使用PHP