How to use apply_filter to wp_link_pages in functions file
-
Hello!
At the link I shared, I’m still using the twenty twenty theme (with a child theme)What I need is to replicate what I did for paginated posts (see the link), with the twenty twenty two theme.
Basically I split my posts in two, to show the footnotes on a next page; and I use the pagination to get “see footnotes” and “back to article” buttons instead of: “Pages: 1, 2”
Of course, this is only meant for posts like this, split in two pages.Since the twentytwentytwo theme doesn’t allow to change the PHP file, I need to use the
apply_filter()
forwp_link_pages()
, and I have no idea how to do that.So far, I managed to do the following with
add_filter()
instead:
(in a child theme for twenty twenty two)add_filter( 'wp_link_pages_args', 'my_function'); function my_function(){ $args = array( 'before' => '<div>', 'after' => '</div>', 'link_before' => '<span class="page-number">', 'link_after' => '</span>', 'next_or_number' => 'next', 'separator' => ' | ', 'nextpagelink' => __( 'See the footnotes', '' ), 'previouspagelink' => __( 'Back to article', '' ), 'echo' => 1 ); return $args; }
It works, but since I’m not using
apply_filter()
as I should, I see the pagination also above the page (on the upper left corner, inside the body)
I guess it’s because I’m not using the hook I need to use and because I’m not defining the $output.I have no idea how to do it.
Thank you so much in advanced!
The page I need help with: [log in to see the link]
- The topic ‘How to use apply_filter to wp_link_pages in functions file’ is closed to new replies.