-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Issue #25 - continue refactoring overrides
- Loading branch information
1 parent
cc236c4
commit 96cac0e
Showing
3 changed files
with
66 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
/** | ||
* Overrides core/query-pagination to implement main query pagination. | ||
* | ||
* Hack until a solution is delivered in Gutenberg. | ||
* | ||
* @param $attributes | ||
* @param $content | ||
* @param $block | ||
* @return string | ||
*/ | ||
function fizzie_render_block_core_query_pagination( $attributes, $content, $block ) { | ||
if ( isset( $block->context['queryId'] ) ) { | ||
$html = gutenberg_render_block_core_query_pagination( $attributes, $content, $block ); | ||
} else { | ||
$html = fizzie_render_block_core_query_pagination_main_query( $attributes, $content, $block ); | ||
} | ||
return $html; | ||
} | ||
|
||
/** | ||
* Renders the `core/query-pagination` block on the server for the main query. | ||
* | ||
* @param array $attributes Block attributes. | ||
* @param string $content Block default content. | ||
* @param WP_Block $block Block instance. | ||
* | ||
* @return string Returns the pagination for the query. | ||
*/ | ||
function fizzie_render_block_core_query_pagination_main_query( $attributes, $content, $block ) { | ||
$html = '<div class="wp-block-query-pagination">'; | ||
$html .= paginate_links( [ 'type' => 'list'] ); | ||
$html .= "</div>"; | ||
return $html; | ||
} |