Created
September 9, 2018 10:52
-
-
Save wpmark/c7e330da89c1c1cc5f43a1bfd4a1909a to your computer and use it in GitHub Desktop.
Extending a WP_Query with a callback example.
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
<?php | |
/** | |
* Changes the job query to show only 5 posts per page. | |
* | |
* @param array $args The current query args. | |
* @return array The modified query args. | |
*/ | |
function wpmark_alter_job_query_args( $args ) { | |
// change the number of posts per page to 5. | |
$args['posts_per_page'] = 5; | |
// return the args. | |
return $args; | |
} | |
add_filter( 'wpmark_job_query_args', 'wpmark_alter_job_query_args' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment