Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/PostType/UI/Console/stubs/archive.blade.php.stub
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,16 @@

@if(get_next_posts_link() || get_previous_posts_link())
<nav class="mt-12 flex justify-between gap-4">
<div>{!! get_previous_posts_link('&larr; Newer') !!}</div>
<div>{!! get_next_posts_link('Older &rarr;') !!}</div>
<div>{!! get_previous_posts_link('&larr; '.__('Newer posts')) !!}</div>
<div>{!! get_next_posts_link(__('Older posts').' &rarr;') !!}</div>
</nav>
@endif
</section>
@endhasposts

@noposts
<div class="mx-auto max-w-3xl px-6 py-32 text-center lg:px-8">
<p class="text-muted">Nothing published yet.</p>
<p class="text-muted">{{ get_queried_object()->labels->not_found }}</p>
</div>
@endnoposts
@endsection
12 changes: 12 additions & 0 deletions tests/Feature/PostType/PostTypeMakeViewsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,15 @@

expect(file_get_contents(($this->viewsDir)().'/'.$template.'-car.blade.php'))->toBe(file_get_contents($stub));
})->with(['single', 'archive']);

it('takes the archive view text from translations every theme already has', function (): void {
$this->artisan('pollora:make:post-type', ['name' => 'Car', '--theme' => 'test-theme', '--archive-view' => true])->assertSuccessful();

$view = file_get_contents(($this->viewsDir)().'/archive-car.blade.php');

// WordPress core translates the pagination labels, the post type's labels the empty state
expect($view)->toContain("__('Newer posts')")
->toContain("__('Older posts')")
->toContain('get_queried_object()->labels->not_found')
->not->toContain('Nothing published yet.');
});
Loading