WordPress.org

Ready to get started?Download WordPress

Forums

Slideshow Gallery
[resolved] Latest version not working, javascript errors, WordPress inserting tags (2 posts)

  1. mtgcs2000
    Member
    Posted 1 year ago #

    Hi,

    I recently updated a clients site to the latest version of wordpress and slideshow gallery and the slideshow has completely stopped working. I've tried for about 5 hours so far to fix it and can't get it to work correctly, so maybe there's something I'm missing.

    I'm loading it into the page with the following code:

    function check_display_home($post_content) {
        	global $post;
            if (is_single() && in_category("Grandview Display Homes")) {
                if (function_exists('slideshow')) {
                	$slideshowCode = do_shortcode('[slideshow post_id="'.$post->ID.'"]');
                    $slideshowCode = str_replace(array("\r\n", "\n", "\r", "\t", "// append the spinner"), "", $slideshowCode);
                    $post_content = $slideshowCode.$post_content;
                }
            }
    
            return $post_content;
        }

    That function is being called via the the_content action like so:

    add_action('the_content', 'check_display_home' );

    The str_replace is to remove stray new lines that are causing the javascript to break, but it is still giving me a javascript error. Here's one page it's on:

    http://www.grandviewhomes.com.au/grandview-display-homes/sapphire/

    If you go into the console in chrome you can see there is a javascript error of:

    Uncaught SyntaxError: Unexpected token ILLEGAL /grandview-display-homes/sapphire/:180

    It looks like this is occuring from the append(' line as it's adding a new line before and after the <div> that it's appending (even though in the source code there is no new line there and I've retyped the code to make sure there are no strange hidden characters and it still doesn't work.

    Do you know why it's started breaking and how to fix it?

    Thanks, Tim

    http://wordpress.org/extend/plugins/slideshow-gallery/

  2. mtgcs2000
    Member
    Posted 1 year ago #

    I figured it out. It must simply be when doing the_content action on the code it breaks it by inserting new lines and <p> tags.

    I simply moved the code to be hard coded into the post instead and it works again.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic