Search code examples
timber

Only load styles for a certain page. If page is - Using Timber/Twig


Using timber/twig for wordpress. Trying to load JS but only for a certain page.

I figured this would be something like

    {% if page = mypage %}
       <link......./>
    {% endif %]

Solution

  • Actually the answer to your question is not depending whether you use Timber or not. You should use conditional statements with the combination of WordPress enqueue functions.

    You can see the examples of such approach for example here: http://geoffgraham.me/wordpress-load-files-on-specific-pages/

    The topic is broad and you have a variety of solutions you may use here. Nevertheless I hope my answer helps you move into the right direction.