admin管理员组文章数量:1323342
I am new to using Timber, but I've wanted a way to use Twig inside Wordpress and ran across Timber, so I'm really excited!
To note, I'm also using the starter theme provided by Timber.
In playing around with things, I was starting out by just trying to set a logo image in base.twig. I added this line of code:
<img src="{{ theme.link }}/static/images/logo.png" />
This works as expected, except that the url given on output is:
<img src="/wp-content/themes/theme-name/theme/static/images/logo.png">
The issue to me is that theme.link
goes one directory too deep. According to the documentation at it should go to the root theme directory, but it's not in my case.
Is there a way to set this or am I just missing something? Thanks in advance for your help!
I am new to using Timber, but I've wanted a way to use Twig inside Wordpress and ran across Timber, so I'm really excited!
To note, I'm also using the starter theme provided by Timber.
In playing around with things, I was starting out by just trying to set a logo image in base.twig. I added this line of code:
<img src="{{ theme.link }}/static/images/logo.png" />
This works as expected, except that the url given on output is:
<img src="http://domain.test/wp-content/themes/theme-name/theme/static/images/logo.png">
The issue to me is that theme.link
goes one directory too deep. According to the documentation at https://timber.github.io/docs/reference/timber-theme/#link it should go to the root theme directory, but it's not in my case.
Is there a way to set this or am I just missing something? Thanks in advance for your help!
Share Improve this question asked Sep 5, 2020 at 17:29 bocajbocaj 31 bronze badge1 Answer
Reset to default 0@bocaj you're doing everything right. Unfortunately, we made a tweak to the starter theme which caused some unanticipated errors like the one you're seeing.
If you can simply move the contents of the /theme-name/theme/
folder into /theme-name/
(including style.css
, functions.php
and others) the problem will resolve itself and links/paths will behave as expected.
We tried to clean up the organization in a recent update. While it's cleaner, it caused this problem. I'm in the process of rectifying this so it won't lead to errors/questions in the future. Sorry for the confusion!
本文标签: pluginsTimber Theme class not fetching the right directory
版权声明:本文标题:plugins - Timber: Theme class not fetching the right directory? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742135700a2422358.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论