Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hey,

    1. Download the Javascript file from: https://gist.github.com/IsmailM/0d4a51a49473649ce7400c8d43e8f85e. This file includes Swipebox – If you have selected Colorbox (in the settings), you will need to add the Javascript file for colour box as well..

    2. Next place this Javascript file into your theme folder. Ensure the file is names: ‘Flickr-justified-gallery.js’

    3. Next you simply need to enqueue the javascript file. This is the difficult bit.

    Firstly, look for a function that includes a line starting with wp_enqueue_script(‘…’);. e.g. I had a function as follows:

    function add_javascript() {
    	wp_enqueue_script( ‘...');
    }

    If you find such function simply add the following line under it.

    wp_enqueue_script( 'justified_grid', get_template_directory_uri() . '/Flickr-justified-gallery.js');

    So you have something as follows.

    function add_javascript() {
    	wp_enqueue_script( ‘...’);
           wp_enqueue_script( 'justified_grid', get_template_directory_uri() . '/Flickr-justified-gallery.js');
    }

    IF you cannot find such a function, you need to create your own function and call the function…

    function add_javascript() {
           wp_enqueue_script( 'justified_grid', get_template_directory_uri() . '/Flickr-justified-gallery.js');
    }
    add_action( 'wp_enqueue_scripts', 'add_javascript' );

    Let me know if you need any further help

    Thread Starter Number1.0

    (@number10)

    Many Thanks… ??

    Thread Starter Number1.0

    (@number10)

    Okay I just tried using the default WordPress theme and it worked perfectly…

    This suggests that something is wrong in my theme… Are there any reason why the Autoptimize wouldn’t work on a theme???

    Is there is a log?

    Thread Starter Number1.0

    (@number10)

    Thanks Frank,

    After digging into the problem, I found out the problem wasn’t actually JS, but rather it was the Critical CSS I was using… I created a Stackoverflow post on it ( see here )

    Apparently the critical CSS of the second sub page was different to the first and as a result was causing a problem…

    Thus, I was wondering if you can have different critical CSS for different pages…

    If not, do you think it would be a good idea to simply create a separate header file in my theme and manually the critical CSS for the sub page there…

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