Skip to content

Instantly share code, notes, and snippets.

@elicus
Created April 24, 2020 11:40
Show Gist options
  • Save elicus/74c21a8379523e5004ef65b59a07cd04 to your computer and use it in GitHub Desktop.
Save elicus/74c21a8379523e5004ef65b59a07cd04 to your computer and use it in GitHub Desktop.
Function to fix error while creating custom divi module
<?php
protected function _enqueue_bundles() {
// Frontend Bundle
$site_url = wp_parse_url( get_site_url() );
$hot_bundle_url = "http://localhost:3000/static/js/frontend-bundle.js";
wp_enqueue_script( "{$this->name}-frontend-bundle", $hot_bundle_url, $this->_bundle_dependencies['frontend'], $this->version, true );
if ( et_core_is_fb_enabled() ) {
// Builder Bundle
$hot_bundle_url = "http://localhost:3000/static/js/builder-bundle.js";
wp_enqueue_script( "{$this->name}-builder-bundle", $hot_bundle_url, $this->_bundle_dependencies['builder'], $this->version, true );
}
}
protected function _enqueue_debug_bundles() {
// Frontend Bundle
$site_url = wp_parse_url( get_site_url() );
$hot_bundle_url = "http://localhost:3000/static/js/frontend-bundle.js";
wp_enqueue_script( "{$this->name}-frontend-bundle", $hot_bundle_url, $this->_bundle_dependencies['frontend'], $this->version, true );
if ( et_core_is_fb_enabled() ) {
// Builder Bundle
$hot_bundle_url = "http://localhost:3000/static/js/builder-bundle.js";
wp_enqueue_script( "{$this->name}-builder-bundle", $hot_bundle_url, $this->_bundle_dependencies['builder'], $this->version, true );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment