Support » Plugin: NextGEN Gallery Optimizer » Pages Go Blank When Deactivating Nextgen Gallery Optimizer

  • Resolved Mighty Gorgon

    (@mighty-gorgon)


    Hi,
    I have two different websites (one online and one in localhost) running with NGG and NGG Optimizer. On both of them when I deactivate NGG Optimizer pages with NGG code go blank! It seems like the_content() no longer returns anything… just blank. Even on pages with no shortcodes whatsoever. the_title() remains fine. (Same issue reported by at least another user here).

    Upon re-activating Optimizer, everything works again.
    I’ve now deactivated and deleted both NextGen Gallery (and ‘uninstalled’, after deleting all my galleries) and NGG Optimizer, and the problem persists. I install Optimizer again without NGG, and the_content() is working again.

    Before installing Optimizer everything was fine and running well.
    I’ve already spent hours and hours trying to figure out the problem, and now I’m afraid I’ll have to rebuild the site back-end entirely.

    Do you have any suggestion?

    https://wordpress.org/plugins/nextgen-gallery-optimizer/

Viewing 2 replies - 1 through 2 (of 2 total)
  • I have found a solution to my specific issue.

    I have designed a new page template for my own use and I was using this code:

    <?php get_template_part( 'content', 'home' ); ?>

    I have found that altering the code in this way solved the issue (but I still don’t understande the rationale behind!

    <?php while ( have_posts() ) : the_post(); ?>
    			<?php get_template_part( 'content', 'home' ); ?>
    		<?php endwhile; // end of the loop. ?>

    With the code above the page showed correctly with NGG Optimizer enabled and on a website where NGG has not been installed at all.

    When installing and then disabling NGG Optimizer, I need the new code to make the page show-up… very very strange… can someone please tell me the difference among the two codes?

    I’ve tried to debug “get_the_content” function and it seems like that without THE LOOP the vars $page and $pages don’t get evaluated correctly. My point is: why with NGG Optimizer (or when NGG Optimizer has never been installed at all!) the page shows up correctly? What I’m missing?

    Plugin Author Mark Jeldi

    (@mark-jeldi)

    Hi @mighty Gorgon,

    Thanks for following up with your solution.

    When you’re working with post/page data and template tags in a WordPress post/page template, you need to include the loop (as you have now done in your code above).

    As Optimizer works with the WordPress loop to detect NextGEN Gallery shortcodes (and only load the necessary scripts and styles as required), it’s possible your loop-less template was essentially “fixed” by Optimizer calling the loop on your template’s behalf. However, due to the created dependency, not show up when Optimizer was deactivated.

    For other loop examples and detailed documentation, I would recommend reading the following page in the codex…

    https://codex.wordpress.org/The_Loop

    Additionally, it’s useful to look at the well-documented code in one of the default WordPress themes, to see how the page templates get pulled together.

    I hope this helps!

    Cheers,
    Mark.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pages Go Blank When Deactivating Nextgen Gallery Optimizer’ is closed to new replies.