简体   繁体   English

如何在子主题中使用父主题的常量。 WordPress的

[英]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.

相关问题 在Wordpress的子主题中使用父主题中定义的常量 - Use defined constants from parent theme in child theme in Wordpress 如何在子主题中覆盖wordpress父主题主题选项 - how to override wordpress parent theme theme options in child theme 如何在父主题的“颜色主题”样式表之后加载我的孩子主题的样式表? - How can I get my Child Theme's Stylesheet to load after Parent Theme's 'Colour Theme' Stylesheets? WordPress /儿童主题-加载父母的选项 - WordPress / Child Theme - Load parent's options 我在wordpress父主题中对模板文件进行了一些自定义更改。 如何确保主题更新时它们不会被覆盖? - I made some custom changes to template files in my wordpress parent theme. How do i make sure they are not overwritten when theme gets updated? WordPress主题“错误:主题将自己定义为其父主题。 请检查模板标题。“ - WordPress Theme “ERROR: The theme defines itself as its parent theme. Please check the Template header.” 如何在wordpress中编辑子主题中父主题的变量值 - How to edit a variable value of parent theme in child theme in wordpress 如何在父主题css之后加载wordpress子主题css - How to load wordpress child theme css after parent theme css WordPress子主题:如何从父主题向子主题添加自定义样式表? - WordPress Child Theme: How do I add a custom style sheet from my parent theme to my child theme? 如何禁用子主题中的WordPress父主题中的钩子 - How to disable hook in wordpress parent theme from child theme
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM