zach-adams / sprig Goto Github PK
View Code? Open in Web Editor NEWSprig is a WordPress Starter Theme that features the Twig Templating Engine
Home Page: http://sprigwp.com
Sprig is a WordPress Starter Theme that features the Twig Templating Engine
Home Page: http://sprigwp.com
According to Twigpress doc and sprig-dir/inc/twigpress.php, you can pass variables to the template with twigpress_render_twig_template($vals = array(), $template = false, $echo = true).
I'm trying to pass variables to the template with the following code but it doesn't work. What am I doing wrong?
single.php:
$vals = array( 'foo' => 'bar' );
twigpress_render_twig_template($vals);
single.twig:
{{ vals.foo }} # Does not print anything #
{{ foo }} # Same #
{{ dump(vals) }} # Prints 'null' #
Please enlighten a n00b! Thanks. :)
I've been trying to develop with the sprig theme but it seems that the twig rendered does not activate when changes are made. Before it shows up I have to activate other themes then activate sprig theme again.
Is gulp suppose to regenerate the twig template automatically? If so then it is not working right on my side.
Update: The changes not reflected are only from the "header.twig" and "head.twig"
I have tried a couple of way but so far the closest I've got is getting all the pages to show up with the title as the home page.
Here is what i wrote on the template, how do I set the proper titles for the pages.
{% extends 'layouts/base.twig' %}
{% block content %}
{% for page in pages() %}{{ set_up_page(page) }}
{% include 'content/content-' ~ page.post_name ~ '.twig' %}
{% endfor %}
{% endblock %}
Have you heard of Timber? Just curious why you went with TwigPress over Timber.
There's no need to have a second package manager when NPM can handle adding in jQuery and Bootstrap. Prior to NPM 3, the only real benefit of Bower was the flat dependency tree, but now with NPM 3+, that is no longer the case.
I like the idea of Twig in a WordPress theme, but there's no reason to have a bunch of files that only contain a call to twigpress_render_twig_template();
According to the WP Template Hierarchy, it is enough to have only one index.php file as a "catch-all" solution.
The only files that don't update the page when they are changed are twig files. In the gulpfile it is watching them though. Any ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.