Skip to content

Commit

Permalink
quickly add horizontal check
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras committed May 5, 2022
1 parent ecc94f2 commit f8c45a3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/block-library/src/query-pagination-next/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ function render_block_core_query_pagination_next( $attributes, $content, $block
// If there is no next page to navigate but a layout justification content setting
// is `center` or `space-between`, render a hidden element to avoid layout shifts when
// visting other pages.
if ( empty( $content ) && isset( $block->context['layout']['justifyContent'] ) && in_array( $block->context['layout']['justifyContent'], array( 'center', 'space-between' ), true ) ) {
$is_horizontal = isset( $block->context['layout']['orientation'] ) && 'horizontal' === $block->context['layout']['orientation'];
if ( empty( $content ) && $is_horizontal && isset( $block->context['layout']['justifyContent'] ) && in_array( $block->context['layout']['justifyContent'], array( 'center', 'space-between' ), true ) ) {
return sprintf(
'<a %1$s>%2$s</a>',
get_block_wrapper_attributes( array( 'style' => 'visibility:hidden;' ) ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ function render_block_core_query_pagination_previous( $attributes, $content, $bl
// If there is no previous page to navigate but a layout justification content setting
// is `center` or `space-between`, render a hidden element to avoid layout shifts when
// visting other pages.
if ( empty( $content ) && isset( $block->context['layout']['justifyContent'] ) && in_array( $block->context['layout']['justifyContent'], array( 'center', 'space-between' ), true ) ) {
$is_horizontal = isset( $block->context['layout']['orientation'] ) && 'horizontal' === $block->context['layout']['orientation'];
if ( empty( $content ) && $is_horizontal && isset( $block->context['layout']['justifyContent'] ) && in_array( $block->context['layout']['justifyContent'], array( 'center', 'space-between' ), true ) ) {
return sprintf(
'<a %1$s>%2$s</a>',
get_block_wrapper_attributes(
Expand Down

0 comments on commit f8c45a3

Please sign in to comment.