ClassicPress 2.1.0 Release Notes

OK, I think I have found the problem and a solution.

The problem is that the script that Bricks uses to insert images is enqueued from a completely different file from the other scripts. I have no idea why. (I have also noted that the JavaScript scripts it supplies are all minified, which is a breach of the GPL license. All code should be supplied in a human-readable form, even if the active files are minified.)

So here’s the solution. It’s in two parts.

  1. Go back and put the code I provided back into the very first file you had it in, i.e setup.php. That will make it work for the scripts loaded from that file.
  2. Now find the file bricks/includes/builder.php and look for these lines:
if ( bricks_is_builder_main() ) {
			// Manually enqueue dashicons for 'wp_enqueue_media' as 'get_wp_editor' prevents dashicons enqueue
			wp_enqueue_style( 'bricks-dashicons', includes_url( '/css/dashicons.min.css' ), [], null );

Right under that add the same code as before, i.e.

/**
 * Scripts
 */

global $wp_scripts;
$deps = $wp_scripts->registered['media-views']->deps;
foreach ( $deps as $key => $dep ) {
	if ( $dep === 'sortable-js' ) {
		unset( $deps[$key] );
		$deps[$key] = 'jquery-ui-sortable';
		ksort( $deps );
		$wp_scripts->registered['media-views']->deps = $deps;
		break;
	}
}

Save the file, and it should work now. You might find a few buttons misaligned on the image insert screen, but they shouldn’t get in the way.

Hello timkaye,

Thank you very much, Bricks Builder 1.11.1.1 works perfect on ClassicPress 2.3.1 after putting the code into setup.php and builder.php.

Thanks a lot again.

1 Like