Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ Check wp_link_pages before rendering in content-single.blade.php #3157

Merged
merged 5 commits into from
Dec 8, 2023
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
17 changes: 16 additions & 1 deletion app/View/Composers/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ public function override()
{
return [
'title' => $this->title(),
'pagination' => $this->pagination(),
];
}

/**
* Returns the post title.
* Retrieve the post title.
*
* @return string
*/
Expand Down Expand Up @@ -66,4 +67,18 @@ public function title()

return get_the_title();
}

/**
* Retrieve the pagination links.
*
* @return string
*/
public function pagination()
{
return wp_link_pages([
'echo' => 0,
'before' => '<p>' . __('Pages:', 'sage'),
'after' => '</p>',
]);
}
}
6 changes: 5 additions & 1 deletion resources/views/partials/content-page.blade.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
@php(the_content())

{!! wp_link_pages(['echo' => 0, 'before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']) !!}
@if ($pagination)
<nav class="page-nav">
{!! $pagination !!}
</nav>
@endif
10 changes: 7 additions & 3 deletions resources/views/partials/content-single.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
@php(the_content())
</div>

<footer>
{!! wp_link_pages(['echo' => 0, 'before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']) !!}
</footer>
@if ($pagination)
<footer>
<nav class="page-nav">
{!! $pagination !!}
</nav>
</footer>
@endif

@php(comments_template())
</article>
Loading