I'm writing a plugin to extend functionality of product page according to the site requirements. I have copied the page edit-product.php in the child theme directory. The theme used is Flatsome. In the plugin I need to enqueue script and css.
"...MarketKing completely disconnects the dashboard from default styles and scripts - we did this because we want to preserve the specific design of the dashboard, regardless of theme and other plugins, and prevent conflict.
Copy the marketking-dashboard-login.php file (from marketking core / public / dashboard) to your child theme, and edit it there.
In that file you will find lines of code that start with:
$wp_styles->queue =
$wp_scripts->queue =
"
For me doesn't work. I work just if I modify marketking-dashboard-login.php in your plugin directory.
To Sum up, I just want to know how to properly load custom js and css in the edit-product.php using wp_enqueue_script and wp_enqueue_style.
I understand that you are working on a modified edit-product.php in your child theme. If you want to enqueue custom scripts / style there, you can just add this CODE at the top of the edit-product.php page:
I have tried to copy marketking-dashboard-login.php in the child them directory, but it seems as if this file is not being considered. instead if I add my code in the original file of your plugin it works. So there is no way to make this change without changing the original marketing plugin file?
I'm writing a plugin to extend functionality of product page according to the site requirements. I have copied the page edit-product.php in the child theme directory. The theme used is Flatsome.
In the plugin I need to enqueue script and css.
I have read in precedent ticket to use the hook
add_action('marketking_dashboard_head', array($this, 'frontend_enqueue'));
public function frontend_enqueue(){
add_action('wp_print_scripts', function () {
wp_enqueue_script('frontend_pagejs', PluginUtils::$PLUGIN_URL . '/js/frontend-page.js', array('jquery'), '1.0'); });
}
An then I have done as I read:
"...MarketKing completely disconnects the dashboard from default styles and scripts - we did this because we want to preserve the specific design of the dashboard, regardless of theme and other plugins, and prevent conflict.
Copy the marketking-dashboard-login.php file (from marketking core / public / dashboard) to your child theme, and edit it there.
In that file you will find lines of code that start with:
$wp_styles->queue =
$wp_scripts->queue =
"
For me doesn't work. I work just if I modify marketking-dashboard-login.php in your plugin directory.
To Sum up, I just want to know how to properly load custom js and css in the edit-product.php using wp_enqueue_script and wp_enqueue_style.
Thank you!
Hi there,
Thank you for purchasing our plugin!
I understand that you are working on a modified edit-product.php in your child theme. If you want to enqueue custom scripts / style there, you can just add this CODE at the top of the edit-product.php page:
Any styles go in the top part, any scripts in the bottom part. The 2 lines there (b2bking / chartist) are just examples and should be removed.
Regarding where exactly to add that, you can add it before "Integrations" around line 90:
Please let me know if that works for you,
Kind regards,
Stefan
Thank you Stefan for you fast reply!
I have tried to copy marketking-dashboard-login.php in the child them directory, but it seems as if this file is not being considered. instead if I add my code in the original file of your plugin it works. So there is no way to make this change without changing the original marketing plugin file?
Hi!
After marketing core update (I was using 1.3.0) and coping edit-product.php and marketking-dashboard-login.php under flatsome-child/marketking
IT WORKS!!!
Thank you so much for your help!