Forum Replies Created

Viewing 1 replies (of 1 total)
  • Here is how I managed to solve this problem. Note that the example below only disables Lightbox on one post/page. To do so on multiple posts, you’ll have to mess around with the code a bit. Just replace “$pid = 240” with the post ID of your home page.

    In functions.php in your active theme directory, add the following:

    // Remove lightbox action
    //wp_deregister_script('lightbox');
    function mytheme_remove_lightbox_js() {
      $pid = 240; // This is the post/page id you would like to disable lightbox on
      global $wp_query; // Call page query object
      if ($wp_query->post->ID == $pid) {
        // Remove lightbox scripts
        wp_deregister_script('lightbox');
        remove_action('wp_head', 'lightbox_styles');
      }
    }
    add_action( 'wp_print_scripts', 'mytheme_remove_lightbox_js', 100 );
Viewing 1 replies (of 1 total)