Hardcode Stacks into theme

Permalink 2 users found helpful
Not sure if this is possible but can Stacks be hardcoded into a theme like scrapbook items could. Can't seem to see a way of doing it.


View Replies: View Best Answer
arcanepain replied on at Permalink Best Answer Reply
Yep...this is easy enough to do, and Andrew has actually detailed the code + process for us on his blog:


In a nutshell, simply created a new stack with a helpful name, add blocks to it as necessary then, as shown on page linked above, simply stick this PHP into your theme where you want the stack to appear!

Eg. create new stack named 'Test Stack'. Add blocks and approve.

In your theme/templates:

$stack = Stack::getByName('Test Stack');

Please note, code above is for 5.5.1...code for 5.5.0 is slightly different, but is also detailed on Andrew's blog post.

Good luck!
abovecreative replied on at Permalink Reply
Great stuff, thought it must be possible. Thanks.