Files
Testing/tbb/wp-content/plugins/theme-check/checks/postsnav.php
sean 0e8a8b3028
Some checks failed
deploy-testing / deploy (push) Has been cancelled
Initial testing snapshot
2026-11-17 16:15:01 -05:00

28 lines
1.2 KiB
PHP

<?php
class PostPaginationCheck implements themecheck {
protected $error = array();
function check( $php_files, $css_files, $other_files ) {
$ret = true;
// combine all the php files into one string to make it easier to search
$php = implode( ' ', $php_files );
checkcount();
if ( strpos( $php, 'posts_nav_link' ) === false &&
strpos( $php, 'paginate_links' ) === false &&
strpos( $php, 'the_posts_pagination' ) === false &&
strpos( $php, 'the_posts_navigation' ) === false &&
( strpos( $php, 'previous_posts_link' ) === false && strpos( $php, 'next_posts_link' ) === false )
) {
$this->error[] = '<span class="tc-lead tc-required">'.__('REQUIRED','theme-check').'</span>: '.__("The theme doesn't have post pagination code in it. Use <strong>posts_nav_link()</strong> or <strong>paginate_links()</strong> or <strong>the_posts_pagination()</strong> or <strong>the_posts_navigation()</strong> or <strong>next_posts_link()</strong> and <strong>previous_posts_link()</strong> to add post pagination.", 'theme-check' );
$ret = false;
}
return $ret;
}
function getError() { return $this->error; }
}
$themechecks[] = new PostPaginationCheck;