-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #86 from ryanwelcher/feature/remove-pagniation
Add control to disable pagnination
- Loading branch information
Showing
5 changed files
with
52 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
/** | ||
* Trait for managing pagination. | ||
*/ | ||
|
||
namespace AdvancedQueryLoop\Traits; | ||
|
||
trait Disable_Pagination { | ||
|
||
public function process_disable_pagination() { | ||
$this->custom_args['no_found_rows'] = $this->get_custom_param( 'disable_pagination' ); | ||
} | ||
} |
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,29 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { ToggleControl } from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
|
||
export const PaginationToggle = ( { attributes, setAttributes } ) => { | ||
const { query: { disable_pagination: disablePagination } = {} } = | ||
attributes; | ||
|
||
return ( | ||
<ToggleControl | ||
label={ __( 'Disable pagination', 'advanced-query-loop' ) } | ||
help={ __( | ||
'Disabling pagination will not show any pagination controls on the front end. It can also provide a performance improvement for complicated queries.', | ||
'advanced-query-loop' | ||
) } | ||
checked={ !! disablePagination } | ||
onChange={ () => { | ||
setAttributes( { | ||
query: { | ||
...attributes.query, | ||
disable_pagination: ! disablePagination, | ||
}, | ||
} ); | ||
} } | ||
/> | ||
); | ||
}; |
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