Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor David Artiss

    (@dartiss)

    What does it do at the moment?

    Thread Starter James I.

    (@nootropixcom)

    It shows it theme on every page as you can see here: https://nootropix.com/photographic-memory-how-to/

    If you’re using $multipage/$numpage/$pages that may be a problem if your outide the loop, and also with compatibility with some plugins since they are globals and are not reset at every loop instance.
    I had a similar problem when I wanted to hide Jetpack Related Posts and show them only on the last page, I’ve tried several times using the aforementioned globals but that wasn’t working, I ended up using str_count on <!–nextpage–> which I’m pretty sure it’s not the most performant way to do it but it’s working at least:

    function jetpackme_move_rp_onlastpage() {
    /* Moves jetpack related posts and shows it only on last page */
        [jetpack code stuff]
            remove_filter( 'the_content', $callback, 40 );
    	if ( ($page[0] == 1) || ($page[0] > 1 && $page[1] == $page[0]) ) {
           		add_filter( 'the_content', $callback, PHP_INT_MAX-99 );
    	}
    }

    I’m pretty sure you can come up with a better solution.

    P.S. One more thing: it’s not a good idea to use PHP_INT_MAX on the_content() hook otherwise it’s impossible to put other plugins after the footnotes. A better idea would be something like PHP_INT_MAX-1 or 2 so you can have 1 or 2 outputs in the_content after the footnotes.

    Thanks,
    G

    Thread Starter James I.

    (@nootropixcom)

    Oops sorry you need also this function:

    function wpse_check_multi_page()
    {
        $num_pages = substr_count($GLOBALS['post']->post_content,'<!--nextpage-->') + 1;
        $current_page = get_query_var( 'page' );
        return array ( $num_pages, $current_page );
    }
    Plugin Contributor David Artiss

    (@dartiss)

    Ah, okay, this is why I asked – your example is different to what I thought you were asking for!

    If I’ve got this right, if you have a multi-page post it puts a reference on each page BUT it’s only for the footnotes on that page – this plugin only generates footnotes a page at a time. What you’d like, though, is the ability to continue the footnotes numbering over the pages and then have the references at the very end for all of them. Have I got that right?

    Thread Starter James I.

    (@nootropixcom)

    Exactly! ??

    Plugin Contributor David Artiss

    (@dartiss)

    Ok, I’ll add this to the list of future enhancements.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Show footnotes only on last pae’ is closed to new replies.