Topic: Not working in Sub-Query

Hi!

I'm using SV in a Wordpress-Installation and it works fine. But sadly not fine at all.

When I display a single page with a gallery, it is displayed as it should.
But I have two pages, which uses a custom query to display multiple sites/pages at once. On these sites, there is no gallery visible.

After debugging, I found the reason: The required JS is not included in the HTML-Head-Section. But I do not understand, why.

Functional Page: http://gleis2-music.de/?p=1982
Non-Functional-Page (with custom query): http://gleis2-music.de/?page_id=1551 (at "Impressionen Schlossfest 2014 - 14. Oktober 2014")

The Theme is created by myself, in the header.php is wp_head(); included.

My Query:

$query = new WP_Query( 'cat=6&posts_per_page=-1' ); 
                        if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();
                ?>
                    <div class="post_caption">
                        <div style="float:right"><?php the_time('d. F Y'); ?></div>
                        <div><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></div> 
                    </div>
                    <div class="post_content"><?php the_content( the_title( '', '', false ) . ' ' . __( 'more &raquo;', FB_BASIS_TEXTDOMAIN ) ); ?></div>

                <?php endwhile; [...]

Any idea, whats wrong? :-(

Thanks!

Re: Not working in Sub-Query

WP-SimpleViewer (v2.3.2.4) will insert load the 'simpleviewer.js' file only if it determines that it is necessary (if it finds a SimpleViewer shortcode in any post displayed on the current page).
It looks like your custom setup may prevent the 'post_content' from being available for WP-SimpleViewer to check through.

The easiest solution would be to just force WP-SimpleViewer to load the 'simpleviewer.js' file in all pages.

Open the plugin's 'wp-simpleviewer.php' file in a plain text editor and change line 18 from:

private $required_core = false;

... to:

private $required_core = true;
Steven Speirs
SimpleViewer Support Team.

Re: Not working in Sub-Query

Hello and thanks for your answer.

The Plugin recognized, that it has to include the JS-File.
But maybe to late?! (to late for Wordpress' wp_head();?)

The JS is included at the bottom of the page, just before the </body>-Tag.

Re: Not working in Sub-Query

Thank you for clarifying the problem.
Please try the following and let me know how you get on.
Open the 'wp-simpleviewer.php' file in a plain text editor and change line 163 from:

$this->add_scripts_wp_core();

... to:

add_action('wp_enqueue_scripts', array(&$this, 'add_scripts_wp_core'));

Hopefully this will solve your problem.

Steven Speirs
SimpleViewer Support Team.

Re: Not working in Sub-Query

Hello again,

now, the "plugins/wp-simpleviewer/svcore/js/simpleviewer.js?ver=2.3.2.4" isn't included anymore in my page with the subquery.

The "<!--START SIMPLEVIEWER EMBED-->" section is still present.

On single pages, nothing changes (= everything is ok, before and after :-))

Any other idea?

Thanks a lot!

Re: Not working in Sub-Query

You could try bypassing the check completely by replacing lines 30-32 of the 'wp-simpleviewer.php' file from:

if (!is_admin()) {
    add_action('the_posts', array(&$this, 'shortcode_check'));
}

... to:

add_action('wp_enqueue_scripts', array(&$this, 'add_scripts_wp_core'));

This should include the 'simpleviewer.js' file in all frontend pages (whether there is a SimpleViewer gallery to be displayed or not) in the <head> section of the page.
If this does not work, then please double-check that your theme includes the following code just before the closing </head> tag.

<?php wp_head(); ?>
Steven Speirs
SimpleViewer Support Team.