Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi

    Please test the following code:

    add_filter( 'wp_link_pages_args', 'ps_change_link_style', 10, 1 );
    
    function ps_change_link_style( $parsed_args ) {
    
        $parsed_args['pagelink'] = 'Page %';
    
        return $parsed_args;
    
    }

    You can paste it in your child theme’s functions.php file using FTP/SFTP/cPanel.

    I hope this will help you.

    Thread Starter gwenm

    (@gwenm)

    Hello, thank you for help ??

    I added the code in my function.php and it crashed my site.

    Thread Starter gwenm

    (@gwenm)

    I realized that I should not use your copy code in my email because it causes a syntax error! So I copied your code from this page and it works perfectly ??

    Now I have Page 1, Page 2. I will have to figure out how to call the section title.

    My page is really long and that’s why I want to cut it by chapter with their titles.

    • This reply was modified 1 year, 6 months ago by gwenm.
    Moderator bcworkz

    (@bcworkz)

    You can use the ‘wp_link_pages_link’ filter to alter the default link’s HTML. The challenge will be how to dynamically determine the correct section title from only the default link’s HTML. All you really have to go on is the main post slug and sub-page number.

    Thread Starter gwenm

    (@gwenm)

    Hello, I’ve been working on it since this morning and I’m going to stop now, my head is like a pumpkin. I thought it was easier than this to do.

    I don’t understand why you can only go from a page 1 to a page 2. 1,2 doesn’t talk to anyone. Referencing level is 0 /page1/ page2/ ect

    There is no plugin for this, at least I have not found yet, but a plugin would be much easier.

    If only wordpress could give us a way to change —page break— to —my title— it would be really simple, but it’s not the case yet … one day maybe ??

    Moderator bcworkz

    (@bcworkz)

    Instead of breaking a page with <!–nextpage–>, you might consider making each subsequent page a child of the initial first page. I’m not sure if there is a ready made function to link to the next/previous child, but since the sub-page title is readily available via query, it’s feasible to generate links using the sub-page titles. Sub-page URLs will end up being something like example.com/main-page/section-name/ with the typical post name permalink configuration.

    You can arbitrarily define page order by publish date or custom field.

    The problem with using section titles as link text with the <!–nextpage–> scheme is the titles are not readily available via query.

    Thread Starter gwenm

    (@gwenm)

    The idea of creating subpages is a great idea! I hadn’t thought of it at all. Very good suggestion ?? Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to change the page break numbering?’ is closed to new replies.