Skip to content

Commit

Permalink
♻️ Check wp_link_pages before rendering in `content-single.blade.ph…
Browse files Browse the repository at this point in the history
…p` (#3157)

Co-authored-by: Brandon <[email protected]>
  • Loading branch information
blift and Log1x authored Dec 8, 2023
1 parent f53aee2 commit 8109f7d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
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>

0 comments on commit 8109f7d

Please sign in to comment.