0

My site has the Newspaper theme by tagDiv, which installs two necessary plugins to make things work better. These plugins are Composer and Standard Pack.

I'm trying to modify the default wp_link_pages() but I don't know how because one of these plugins has code that changes the function.

I don't want to change the plugin file because it is frequently updated. The problem is that the code is not inside a post file like single.php. And I'm not finding a way to do that.

The plugin code is:

enter image description here

I made this PHP for my own plugin but I don't know how to make it work. I haven't found a way to do this with an action or a filter:

function my_new_pagination() {
    if (!is_single()) {
            return '';
        }
        return wp_link_pages(array(
        'next_or_number' => 'next',
        'before' => '<div class="new_pag">',
        'after' => '</div>',
        'nextpagelink' => '<span class="testnav">' . __('Next') . ' »</span>',
        'previouspagelink' => '<span class="testnav">« ' . __('Previous') . '</span>',
        'pagelink' => false,
        'echo' => false
    ));
}

Any ideas? Thanks

4
  • "I don't know how to make it work" - just call your my_new_pagination() function from within your template files? But if the get_post_pagination() is pluggable (it's wrapped inside a if ( ! function_exists( 'get_post_pagination' ) ) block), then that means you can override the function from within a child theme, using the functions.php file.
    – Sally CJ
    Commented Jan 18, 2022 at 9:14
  • Thanks Sally, I’ll give a try to a child theme. Commented Jan 18, 2022 at 16:03
  • Let us know what the solution you ended up using (so that others could benefit from it), but keep in mind, support for 3rd-party themes is off-topic on this site, and you should instead ask in the theme's support forums. :)
    – Sally CJ
    Commented Jan 18, 2022 at 23:39
  • 1
    I actually found an easy solution in this child theme tutorial from tagDiv. It's exactly what I was looking for, I figured out I can change the default single and loop files within the child. Now it's working. Thanks Sally for the hint. Commented Jan 19, 2022 at 2:28

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.