admin管理员组文章数量:1435859
I know that using a function like the following (in functions.php
) allows me to customize pagination options:
function custom_theme_pagination(){
global $wp_query;
echo paginate_links();
}
... provided that the theme file then contains <?php custom_theme_pagination(); ?>
wherever I want the pagination to show.
However, what I would like to achieve is control how any instance of <?php the_posts_pagination(); ?>
will appear without having to create a custom function and then replacing the code in my theme files with <?php custom_theme_pagination(); ?>
instead of <?php the_posts_pagination(); ?>
.
Is it possible to modify or give arguments for the original <?php the_posts_pagination(); ?>
-- in the functions.php file, not in theme files -- without wrapping it in a custom function? If yes, can you explain in detail how that works, please? I ask for details because I want to learn how to do this with pagination and be able to use what I learned for other similar matters that might come up.
Thanks in advance.
I know that using a function like the following (in functions.php
) allows me to customize pagination options:
function custom_theme_pagination(){
global $wp_query;
echo paginate_links();
}
... provided that the theme file then contains <?php custom_theme_pagination(); ?>
wherever I want the pagination to show.
However, what I would like to achieve is control how any instance of <?php the_posts_pagination(); ?>
will appear without having to create a custom function and then replacing the code in my theme files with <?php custom_theme_pagination(); ?>
instead of <?php the_posts_pagination(); ?>
.
Is it possible to modify or give arguments for the original <?php the_posts_pagination(); ?>
-- in the functions.php file, not in theme files -- without wrapping it in a custom function? If yes, can you explain in detail how that works, please? I ask for details because I want to learn how to do this with pagination and be able to use what I learned for other similar matters that might come up.
Thanks in advance.
Share Improve this question asked Mar 21, 2019 at 10:44 jsmodjsmod 5013 silver badges18 bronze badges1 Answer
Reset to default 1Is it possible to modify or give arguments for the original -- in the functions.php file, not in theme files -- without wrapping it in a custom function?
No.
There are no hooks that allow modifying the arguments to this function. Wrapping it in your own function is the way to go. There's nothing inherently smarter or superior or more smarter about using filters.
本文标签: paginationModifying thepostspagination from within functionsphp instead of template files
版权声明:本文标题:pagination - Modifying the_posts_pagination from within functions.php instead of template files 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745669225a2669469.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论