[英]How I can Use parent theme's constants in child Theme. Wordpress
I have Created a child theme when i load site it did not find logo image which is saved in a constant in parent theme's function file and httpd.exe memory goes upt to 1GB and did not show any error then i check apche php error log below error found. 我在加载网站时创建了一个子主题,但未找到徽标图像,该徽标图像保存在父主题的功能文件中的常量中,并且httpd.exe内存升至1GB,并且未显示任何错误,然后我检查了以下apche php错误日志发现错误。
So the question is how i can use constant defined in Parent theme function file to child theme should i need to redefine in child theme. 所以问题是我应该如何在父主题中重新定义子主题时如何使用在父主题函数文件中定义的常量。
[02-Jul-2015 02:53:21 UTC] PHP Warning: getimagesize( http://localhost/wordpress/wp-content/themes/my-shahid/images/logo.png ): failed to open stream: HTTP request failed!
[2015年7月2日02:53:21 UTC] PHP警告:getimagesize( http://localhost/wordpress/wp-content/themes/my-shahid/images/logo.png ):无法打开流:HTTP请求失败了! HTTP/1.0 404 Not Found in C:\\xampp\\htdocs\\wordpress\\wp-content\\themes\\my-framework\\functions.php on line 233
在第233行的C:\\ xampp \\ htdocs \\ wordpress \\ wp-content \\ themes \\ my-framework \\ functions.php中找不到HTTP / 1.0 404
at line 233 this is the code 在第233行,这是代码
232: $logo = IMAGES . '/logo.png';
233: $logo_size = getimagesize( $logo );
$logo = IMAGES . $ logo =图像。 '/logo.png';
'/logo.png'; this is not the right way to define constant in WordPress, instead you should define it as.
这不是在WordPress中定义常量的正确方法,而应将其定义为。
define("THEME_LOGO", IMAGES ."/logo.png");
and then you can use it simply by writing THEME_LOGO, anywhere in theme scope 然后您只需在主题范围内的任何地方编写THEME_LOGO即可使用它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.