1. Go to this page and download the library: Download devgeniem/dustpress library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
devgeniem / dustpress example snippets
/**
* Change the pagination link format from '?paged=' to 'page/'.
* This works only on pages with no other GET parameters.
*/
custom_pagination_link( $page_link ) {
return str_replace( '?paged=', 'page/', $page_link );
}
add_filter( 'dustpress/pagination/page_link', 'custom_pagination_link' );
public function Query() {
// Args might be set if the function is in a submodel or
// they can come from a DustPress.js AJAX request.
$args = $this->get_args();
$per_page = (int) get_option( 'posts_per_page' );
$page = isset( $args['page'] ) ? $args['page'] : 1;
$offset = ( $page - 1 ) * $per_page;
$query_args = [
'post_type' => 'post',
'posts_per_page' => $per_page,
'offset' => $offset,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
'no_found_rows' => false,
'query_object' => false,
];
// This returns a WP_Query like object.
// Queried posts are accessible in dust under the 'Query' key.
return \DustPress\Query::get_posts( $args );
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.