jQuery plugin help: timeout-dialog.js

  • Answered
I can't get a jQuery plugin (https://github.com/rigoneri/timeout-dialog.js) to work in WordPress. I have: 1. Downloaded the plugin to the CPanel plugin folder 2. Created an index.php file and loaded the scripts. Each "$my_js_ver" gives me "Warning: filemtime(): stat failed for". I think it's due to symlinked files but I don't know how to correct it. add_action('wp_enqueue_scripts', 'timeout_dialog_scripts'); function timeout_dialog_scripts($hook){ $my_js_ver = date("ymd-Gis", filemtime( plugin_dir_path( __FILE__ ).'/home/xxxxx/public_html/wp-content/plugins/timeout-dialog/js/timeout-dialog.js' )); $my_css_ver1 = date("ymd-Gis", filemtime( plugin_dir_path( __FILE__ ).'/home/xxxxx/public_html/wp-content/plugins/timeout-dialog/css/timeout-dialog.css' )); $my_css_ver2 = date("ymd-Gis", filemtime( plugin_dir_path( __FILE__ ).'/home/xxxxx/public_html/wp-content/plugins/timeout-dialog/css/index.css' )); wp_enqueue_script('jquery'); wp_register_script('timeout-dialog.js', plugins_url('/home/xxxxx/public_html/wp-content/plugins/timeout-dialog/js/timeout-dialog.js', __FILE__ ), array('jquery'), $my_js_ver); wp_enqueue_script('timeout-dialog.js'); wp_register_style('timeout-dialog.css', plugins_url('/home/xxxxx/public_html/wp-content/plugins/timeout-dialog/css/timeout-dialog.css', __FILE__), array('query'), false, $my_css_ver1); wp_enqueue_style('timeout-dialog.css'); wp_register_style('index.css', plugins_url('/home/xxxxx/public_html/wp-content/plugins/timeout-dialog/css/index.css', __FILE__), array('query'), false, $my_css_ver2); wp_enqueue_style('index.css'); } 3. The site states to output the code $.timeoutDialog(); to implement it on certain pages. I think I may be doing this incorrectly. I placed this script at the bottom of the password protected page. jQuery(document).ready(function($){ $.timeout-dialog( timeout: 2, countdown: 8, title: Your session is about to expire!, message: You will be logged out in {0} seconds., question: Do you want to stay signed in?, keep_alive_button_text: Yes, Keep me signed in, sign_out_button_text: No, Sign me out, keep_alive_url: http://xxxxxx.com, logout_url: http://xxxxxx.com/xxxxxx, logout_redirect_url: http://xxxxxxx.com/xxxxxx, restart_on_yes: TRUE, dialog_width: 350, ); } I've tried without using the hooks and tried another format for the script. (function( $ ) {     "use strict";     $(document).ready( function(){} ); })(jQuery); Any ideas on what I'm doing wrong?
Hello msslrb,

Sorry for the issue with the custom jquery code. When I visited the link you provided it does not show it as a plugin in the sense that it was made for that purpose and for installation within WordPress. It's a jQuery plugin. You will need to speak with the developer of the code to see how it can be installed for use within WordPress and determine its requirements to make sure your server has everything required for its proper installation and function. Apologies that we don't have a direct solution for you at this point, but please speak with the developer to help you get it properly installed.

If you have any further questions, please let us know.

Kindest regards,
Arnel C.