Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/loops/2.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
Loops Shopify中的博客循环不起作用_Loops_Blogs_Shopify - Fatal编程技术网

Loops Shopify中的博客循环不起作用

Loops Shopify中的博客循环不起作用,loops,blogs,shopify,Loops,Blogs,Shopify,我的index.liquid中有以下代码块 <div class="news-notable"> <h2>New &amp; Notable</h2> <ul> {% for article in blogs[blog.news].articles limit: 4 %} <li><a href="{{ arti

我的index.liquid中有以下代码块

<div class="news-notable">
            <h2>New &amp; Notable</h2>
            <ul>
                {% for article in blogs[blog.news].articles limit: 4 %}
                <li><a href="{{ article.url }}">{{ article.title }}</a><br />
                <span class="date">{{ article.published_at | date: '%b %d, %Y' }}</span></li>
                {% endfor %}
             </ul>
        </div>
这也没用。
提前感谢您的帮助

您需要将blog句柄包含在方括号内

例如,如果您的博客句柄是
news
,则For循环将是:

{% for article in blogs[news].articles limit: 4 %}
...
{% endfor %}
或:


啊,好吧,有道理。我回家后会试试这个。非常感谢。没问题,很乐意帮忙!
{% for article in blogs[news].articles limit: 4 %}
...
{% endfor %}
{% for article in blogs.news.articles limit: 4 %}
...
{% endfor %}