How to create a template page?

I created this file template-total.blade.php

in resources / views / template-total.blade.php

{{--
  Template Name: Template Full
--}}

@extends('layouts.app')

@section('content')
  @while(have_posts()) @php(the_post())
    <h2>Full</h2>
    @include('partials.content-page')
  @endwhile
@endsection

However, when I try to assign the new Page Template to a Page, my new template doesn’t show up in the dropdown menu under “page attributes”.

I already cleared the cache and executed the production command but it still does not appear

Sage 9 beta 3

This seems to be related to my issue: Weird error when removing page templates

It has probably to do with a transient not being created immediately. Give it 15 min or so and it will show up or go to your database wp_options table and search for .blade.php in option_value column with %LIKE%

This must result in a transient record with a name something like _transient_files_bcb76f9f446f36f5fb437ae045776ba726a898a1164a29b762240b2

You can delete that record (I would still recommend to make a backup first) and then try to reload the edit page and your page template will show up. Im still not sure what’s causing the page template not show up by itself. I’m experiencing this issue since yesterday.

I had the same problem, just about went crazy with this. I could rename old templates and the new name would show up, just not my new template (which started out as a duplication of an old template, just change of name)

Deleting the file transient solved this - the template showed up right away.

I used the Transient Manager plugin in order to delete the transient - https://wordpress.org/plugins/transients-manager/

It’s been weeks since I originally worked on this site, but I don’t remember having this problem initially. Could this file transient behavior be a WordPress 4.9 addition? That’s the only thing that I think has changed between then and now

2 Likes

Looks like this is indeed a WordPress 4.9 bug:

https://core.trac.wordpress.org/ticket/42573

2 Likes

if it works clearing all transients

in tools -> delete all transients

Here is a small plugin that flushes the template cache on admin load.

1 Like

This has been fixed. Need to update to version 4.9.1, which was released yesterday.