You should use wp_localize_script()
after enqueuing your JS file that calls the countdown
method. I’m assuming you stored the date in an option called date_name
like January 1, 2015 13:30:00
.
In your case, you are storing it as an array with month, day, year, and time in the correct format
, so you should convert it to the January 1, 2015 13:30:00
format.
wp_enqueue_script( 'jsfilename' );
$stored_date = get_option( 'date_name', 'default value' );
// process stored date so that it gets to the January 1, 2015 13:30:00 format
$date_options = array( 'mydate' => $stored_date );
wp_localize_script( 'jsfilename', 'dateopts', $date_options );
Then in your JS file, you call:
$('.live-countdown').countdown({ date: dateopts.mydate });
Related Posts:
- What’s the best method for emptying an option created with the Settings API?
- How to add a new plugin page under desired Options page?
- Unified Approach for Placing Option Pages
- WordPress plugin options and jQuery
- How to localize data array in plugin’s option page
- Menu_slug used for creating options page
- framework for plugin/theme options panel? [closed]
- ajaxurl not defined on front end
- Why does WordPress use outdated jQuery v1.12.4?
- How to add a javascript snippet to the footer that requires jQuery
- How do I add CSS options to my plugin without using inline styles?
- “Error: Options Page Not Found” on Settings Page Submission for an OOP Plugin
- Is get_option function cached?
- How to include jQuery and JavaScript files correctly?
- How come `wp_options` table does not have an index on `autoload`?
- Update Option Stored in Multi-Dimensional Array
- Passing arguments to a admin menu page callback?
- What are the advantages to the Settings API?
- Adding Widget form fields dynamically
- Where to store plugin settings fields
- How Do I Use jQuery UI In My Plugin
- Is get_option() faster than accessing get_transient()?
- What is the correct way to build a widget using OOP
- Remove profile picture option (and other things) from profile.php (in admin)
- Admin settings update updating every time home page is hit?
- Releasing new plugin version, how to rename old options keys?
- WordPress updates defined vs add_filter?
- Creating Settings Page with dropdowns for Plugin
- Test to see if jQuery or Prototype is queued by another plugin?
- How to properly sanitize strings for update_option()
- What is the recommended way to create plugin administration forms?
- jQuery in header or footer
- Hook the Keydown Event in the TinyMCE Post Editor
- Is it possible to add an admin page using add_submenu_page() and pass a var in the query string?
- Add a jQuery function to admin pages
- Overwriting Core WordPress Functions with Plugins
- How to Add a .js file Only in one specific Page Dynamically to Head
- wp_localize_script $handle
- How do I handle multiple Submit buttons in plugin’s option page?
- Naming Admin Menus and Submenus
- Help adding image upload functionality to widget
- How to trap “Publish” button to check for meta box validation?
- Current class on admin menu using add_submenu_page()
- Deletion of shared options using uninstall.php
- How to fetch serialized data from wordpress options
- Add Admin Menu Inside Construct or Init
- Why won’t register_setting() create a setting?
- Use js script from one plugin in another plugin
- Multiple entries in get_option results? or why is _multiwidget set to 1?
- Hook event for upload image in the menu
- Dropdown list of pages to get page id to store in plugin options
- update_option is not working!
- update_option_{$option} Too Few Arguments
- Menu Error in Admin Console with Custom Plugin: You do not have sufficient permissions to access this page
- Save user-specific options in WordPress admin
- How to store accumulate multiple option values in a single array using Options_API
- Using Ajax call in jQuery doesn’t work in widget
- add_menu_page() with function inside a class [duplicate]
- wp_enqueue_style built in styles
- How to add Font Awesome 5 icons in WP Admin dashboard menu?
- WP_LOCALIZE_SCRIPT doesn’t work
- Creating option to allow user to select the page my plugin content will display on
- Use of global variables within plugin [closed]
- How to put placeholder text in the main post input area?
- What is the difference between these two methods of writing $ instead of jQuery in WordPress [closed]
- Admin-ajax.php appending a status code to ajax response
- array_map() for sanitizing $_POST
- Plugin with specific admin menu icon
- Plugin admin page meta_box toggle and order state not saving
- WordPress Plugin Setting’s POST
- Performance of several get_option() calls
- Extend plugin options page
- Can I use the different settings sections over different pages using the save options group?
- Options API – Validation Callback $input is NULL
- Ajax in WordPress – path issue
- Best choice of options/settings framework for plugin/theme development
- Correct way check nonce (security) using old Options API
- OOP Plugin and Menu – Call to undefined function register_setting()
- How to store a medium amount of options?
- wp_localize_script and host/browser cache
- Mixing Regular Javascript With jQuery in a Plugin
- How to add settings subpage from a plugin to a settings page created in theme?
- Plugin options not being saved or created
- Loading jQuery and jQuery plugin script files correctly [duplicate]
- Remove Internal Style Sheet if no Value Provided?
- jquery document ready function not being called [closed]
- What could cause my plugin’s options/settings page not to load?
- How to set “Site Address (URL)” programmatically on WP multisite?
- WordPress setting with select – where is my mistake?
- Add a row on clicking each post featured image
- Using wp_parse_args to set up Plugin Default Settings
- how to add Jquery script to one page?
- Is there an event or an other method that tells me the preview is loaded?
- Custom delete option button in plugin settings
- Storing product price data in the database
- Global State During an Admin Post
- How To Change Post Author Default?
- WP_Editor – Saving Value into Plugin Option – Stripping HTML
- Howto: Use Custom Post Types as Submenu Items in Admin
- Sub Menu content is being duplicated