• Resolved teigram

    (@teigram)


    There is something going on with the short code or other issue. This happened after the recent WP update to 5.2.3. I was using the Niva Slider in the plugin. The slideshow can be seen when initially loading the page, but upon clicking the slideshow, it disappears. I have turned off all other plugins, the issue doesn’t change. As well, I cannot see the slideshow in the WP preview or the MetaSlider preview. Thanks for your help.

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 19 total)
  • Hi @teigram

    I have turned off all other plugins, the issue doesn’t change

    I see you have JetPack active, can you confirm disabling this doesn’t change anything?

    Thread Starter teigram

    (@teigram)

    Yes, I turned jetpack off with all the other plugins.

    Hi @teigram

    Can you disable it now so I can check? This looks like an issue with JetPack. If so I can give you some code to fix it.

    Thread Starter teigram

    (@teigram)

    ok. I just disabled it.

    It appears to be working correctly now, right?

    Thread Starter teigram

    (@teigram)

    yes, it looks like it works.

    Try adding this to functions.php and enable Jetpack. It should disable their image loading mechanism specifically for MetaSlider slides.

    add_filter('jetpack_photon_skip_image', 'metaslider_remove_jetpack', 10, 2);
    add_filter('jetpack_lazy_images_skip_image_with_attributes', 'metaslider_remove_jetpack', 10, 2);
    function metaslider_remove_jetpack($val, $src) {
    
    	// The lazy load filter send the src as a param
    	$src = isset($src['src']) ? $src['src'] : $src;
    
    	// Get an array of slideshow images
    	$slide_image_names = array_map(function ($post) {
    		$image = wp_get_attachment_url(get_post_thumbnail_id($post->ID));
    
    		// Extract the filename only from the slide image as WP will add sizes
    		return pathinfo(end(explode('/', $image)))['filename'];
    	}, get_posts(['post_type' => 'ml-slide', 'posts_per_page' => -1]));
    
    	// Filter through every slide image and see if Jetpack is trying to serve it
    	$skip = array_filter($slide_image_names, function ($slide_src) use ($src) {
    		return strpos($src, $slide_src) !== false;
    	});
    
    	return count($skip) ? true : $val;
    }
    Thread Starter teigram

    (@teigram)

    Could you guide me where to place it in the functions file?

    I place the code before the // END ENQUEUE PARENT ACTION
    and got this error message. The code was pasted on line 24.

    Your PHP code changes were rolled back due to an error on line 24 of file wp-content/themes/twentysixteen-child/functions.php. Please fix and try saving again.
    syntax error, unexpected ‘&’

    It needs to be within <?php and ?> tags but that file can be different depending on your theme. Maybe near the top?

    Thread Starter teigram

    (@teigram)

    It didn’t work near the top, I’m still getting the same message with the &. Here is the code in my functions file.

    <?php
    // Exit if accessed directly
    if ( !defined( ‘ABSPATH’ ) ) exit;

    // BEGIN ENQUEUE PARENT ACTION
    // AUTO GENERATED – Do not modify or remove comment markers above or below:

    if ( !function_exists( ‘chld_thm_cfg_locale_css’ ) ):
    function chld_thm_cfg_locale_css( $uri ){
    if ( empty( $uri ) && is_rtl() && file_exists( get_template_directory() . ‘/rtl.css’ ) )
    $uri = get_template_directory_uri() . ‘/rtl.css’;
    return $uri;
    }
    endif;
    add_filter( ‘locale_stylesheet_uri’, ‘chld_thm_cfg_locale_css’ );

    if ( !function_exists( ‘chld_thm_cfg_parent_css’ ) ):
    function chld_thm_cfg_parent_css() {
    wp_enqueue_style( ‘chld_thm_cfg_parent’, trailingslashit( get_template_directory_uri() ) . ‘style.css’, array( ) );
    }
    endif;
    add_action( ‘wp_enqueue_scripts’, ‘chld_thm_cfg_parent_css’, 10 );

    // END ENQUEUE PARENT ACTION

    Is there a chance you have an old version of PHP?

    The code I gave should be PHP 5.4.

    Thread Starter teigram

    (@teigram)

    I am not sure. Where do I find out which version I have? Do I check with my web hosting company?

    Thread Starter teigram

    (@teigram)

    I checked my web host — it is PHP 5.4

    Hi @teigram

    There might be a WP plugin you can install to check, otherwise if you have a cpanel login to your hosting there is usually an option there. I can convert the code to an older PHP version but if you are on PHP5.4+ already then it wouldn’t make a difference.

    PHP 7.3 is the latest version by the way, but if you have any outdated plugins or themes, using this version could break something. Update with care.

    Maybe you just need to make sure the code is copy/pasting without special characters. So paste the code, then manually delete and retype and quotes (‘).

Viewing 15 replies - 1 through 15 (of 19 total)

The topic ‘Slide short code or other issue’ is closed to new replies.