Closed FabriceJoseph closed 1 year ago
I am experiencing this as well. As a workaround:
{% set i = 1 %}
{% for image in instagram.getInstagramMedia(4, false).all if i < 12 %}
<article>
<a href="{{ image.meta.permalink }}" target="_blank" title="{{ image.meta.caption }}">
<img src="{{ image.cropZoom(600, 600).url }}" />
</a>
</article>
{% set i = I + 1 %}
{% endfor %}
Hi @xadammr. Thank you for your answer. I did pretty much the same thing :
{% for image in instagram.getInstagramMedia(12, false).all %}
{% if(loop.index <= 12) %}
<a style="font-size: 0;" href="{{ image.meta.permalink }}" target="_blank">
<img src="{{ image.cropZoom(200, 200).url }}" />
</a>
{% endif %}
{% endfor %}
In typical Facebook/Instagram/Meta fashion it appears they've changed the API with no backwards compatibility. It seems there's no longer a limit
field for the /media
endpoint: https://developers.facebook.com/docs/instagram-basic-display-api/reference/media
You guys are on the right track, I would modify this template to do this:
{% for image in instagram.getInstagramMedia|slice(0,12) %}
That should work fine using Twig's slice function to start at 0 offset, and get 12 entries
Released with this fix in the display-media.html.twig
template + updated the docs
Thank you @rhukster . Netherless, to retrieve the very last 12 posts, I had to use this syntax with the .all :
{% for image in instagram.getInstagramMedia(0,false).all|slice(0,12) %}
Hi, For the past few months, the limit of 12 posts that I pass as a parameter of the instagram.getInstagramMedia function no longer has any effect. The amount of instagram posts collected continues to increase. Today, it's 27 posts recovered (instead 12). I have version 1.1.0 of the plugin and the code is as follows:
Anyone else have the same problem?
Thank you for your help Fabrice