Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter James I.

    (@nootropixcom)

    Hi,

    The problem is that a lot of CSS is removed even though CSS usage is only 22%.

    In the past there was the option to disable “optimize css” from what I understand, how can I do it now?

    Thanks,

    Giacomo

    Thread Starter James I.

    (@nootropixcom)

    bump..

    Thread Starter James I.

    (@nootropixcom)

    Exactly! ??

    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 );
    }
    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

Viewing 5 replies - 1 through 5 (of 5 total)