ekandreas / bladerunner

WordPress plugin for Laravel Blade templating DEPRECATED
http://bladerunner.elseif.se
12 stars 1 forks source link

Custom template returns plain text #75

Closed davidohlin closed 6 years ago

davidohlin commented 6 years ago

Hi!

New to bladerunner, but I've read through the documentation a few times and can't seem to figure this one out.

I'm using Bladerunner (1.7.4) with Wordplate (6.1.0). I have two templates, index.blade.php and contact.blade.php. Index works fine but when I apply the contact template to a page, the front-end looks like this:

https://i.imgur.com/tmTDaui.png

The code in contact.blade.php is copy-pasted from index.blade.php, except for the template name comment:

{{--
    Template Name: Contact
--}}

@section('content')
    Hello world
@endsection

I've been looking around but can't find any similar issues.

ekandreas commented 6 years ago

Hi! I don't know if you can mix in that way. First of all, wp needs a contact.php in the theme root. And it should have the standard php comments, eg,

<?php
/*
* Template Name: Contact
*/

echo view('views.pages.contact');

And then create a blade template under views/pages/contact that uses a layout master that it extends, eg:

@extend('views.layouts.master')
@section('content')
 ...
@endsection

Then create a master.blade.php in views/layouts that has a @yield('content') to fill.

Lycka till! :-)

davidohlin commented 6 years ago

Works like a charm! I'll have to read up on blade in general I guess.

Thank you very much for the quick reply! 🍻