artifex404 / grav-plugin-instagram

Instagram is a simple plugin that includes Instagram feed to your Grav website.
MIT License
16 stars 12 forks source link

How to use variables inside instagram_feed()? #10

Closed Sogl closed 6 years ago

Sogl commented 6 years ago

Hi!

I'm trying to implement custom template with this plugin. When I put {{ instagram_feed() }} into my twig, I see output of my templates/partials/instagram.html.twig.

But how to pass some page.header variables and other parameters to this function and use it inside instagram.html.twig?

artifex404 commented 6 years ago

If you don't need those variables in the Instagram loop, you could just wrap your instagram block into your own .twig template and pass all the needed variables to it.

The function instagram_feed() single purpose is to just display the feed.

If you really need, you can customize the plugin and pass your needed variables here: https://github.com/artifex404/grav-plugin-instagram/blob/master/instagram.php#L99

Sogl commented 6 years ago

Simple {% include 'partials/instagram.html.twig' %} don't work.

Here I see that function expect parameters: https://github.com/artifex404/grav-plugin-instagram/blob/master/instagram.php#L58 but this variable is not used. Why?

artifex404 commented 6 years ago

Please refer to PHP and twig documentation. Closing this issue as it is not related to the plugin functionality.

Sogl commented 6 years ago

This is what I needed: https://github.com/artifex404/grav-plugin-instagram/pull/11