admin管理员组文章数量:1130349
One of the plugin is en-queuing a js file in the front-end of my site. I was trying to overwrite it by creating a custom function and hooking it in WP_Footer.
The js added by the plugin file is for the jquery datepicker. I want to modify the datepicker function from my theme file.
Below is how I am hooking the custom function to wp_footer to overwrite the jquery added via plugin from theme with no success:
function wpte_calendar_custom_code()
{ ?>
<script type="text/javascript">
//all of my new jquery code goes here
</script>
<?php
add_action( 'wp_footer', 'wpte_calendar_custom_code' );
Also this is how the datepicker script is enqueue in the plugin that I am trying to overwrite:
The plugin datepicker script is inside the public facing class Wp_Travel_Engine_Public of the plugin and the enqueue is done by the function enqueue_scripts like this:
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wp-travel-engine-public.js', array( 'jquery' ), $this->version, false );
Any help on this will be more than appreciable.
Thank you.
One of the plugin is en-queuing a js file in the front-end of my site. I was trying to overwrite it by creating a custom function and hooking it in WP_Footer.
The js added by the plugin file is for the jquery datepicker. I want to modify the datepicker function from my theme file.
Below is how I am hooking the custom function to wp_footer to overwrite the jquery added via plugin from theme with no success:
function wpte_calendar_custom_code()
{ ?>
<script type="text/javascript">
//all of my new jquery code goes here
</script>
<?php
add_action( 'wp_footer', 'wpte_calendar_custom_code' );
Also this is how the datepicker script is enqueue in the plugin that I am trying to overwrite:
The plugin datepicker script is inside the public facing class Wp_Travel_Engine_Public of the plugin and the enqueue is done by the function enqueue_scripts like this:
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wp-travel-engine-public.js', array( 'jquery' ), $this->version, false );
Any help on this will be more than appreciable.
Thank you.
本文标签: pluginsOverwrite js code using WPFooter
版权声明:本文标题:plugins - Overwrite js code using WP_Footer 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749222023a2335100.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论