You’re not accessing the value correctly. The 2nd argument of wp_localize_script
is the name of a JavaScript object that your data will be added to. In your case it’s wpa_data
. This means that the image_path
is accessed at wpa_data.image_path
:
$(function(){
jQuery(document).ready(function() {
$('#home').backstretch([
wpa_data.image_path+"home-bg-slideshow1.jpg",
wpa_data.image_path+"home-bg-slideshow2.jpg",
wpa_data.image_path+"home-bg-slideshow3.jpg",
], {duration: 2000, fade: 750});
});
})
Related Posts:
- Create Image Uploader for Widget
- How to resize image on client-side before upload?
- Passing PHP Variables to JS using Localize Script
- Using wp_localize_script to store the template url into a variable to use in JS
- How can I output a php value into a JS file within WordPress?
- Ajax random number always the same
- Integrating PHP into Javascript to display map markers with Google API – problem with wp_localize
- How to register javascript variables in wp_localize_script?
- wp_localize_script() and JavaScript namespaces
- Some problems in custom widget
- Show next image in array if page is revisited by same logged user
- Import js variables loaded via wp_localize_script() into js module without global scope connection
- bloginfo url in javascript
- Adding a custom image upload size and making it selected by default?
- WordPress Infinite Scroll without using any plugin
- WordPress Ajax always returns a 404 error
- Conditionally loading JavaScript based on the Advanced Custom Fields in the post
- Permanently remove first image from posts
- WordPress customizer: load controls in a custom div
- Is there a reason why my wordpress PHP page isn’t loading into my PHP template
- Limit the Excerpt field in WP-Admin in words
- Audio Player not loading when the content is loaded through Ajax, MediaElement.js no applied
- Customizer Show/Hide Logo and Site Title
- Understanding WordPress child theme custom JS loading
- Use different javascript files for each page on website
- How to get custom image size for image uploaded in Customizer
- Using wp_get_image_editor in a standalone script
- Create custom blocks for bootstrap
- Click loads template via ajax
- Styling images coming from another blog
- Sending jsPDF documents to the server
- IMG src weird behaviour inside a single post loop
- js file in root loading without
- Use menu link or onClick to set a variable
- Adding custom directory and PHP files in wordpress
- Best practice for migration friendly images in posts/pages?
- Displaying admin notices inside the block editor from rest_after_insert_{$this->post_type} hook
- Unread Repeater field IMG alt not working
- wordpress visual composer change grid builder post link
- PHP array to JS array to use in google map
- How to add a Custom Mailchimp AJAX Newsletter Subscribe Form
- How to make own crop image function for WordPress plugin
- Fancybox type popup window that’s not an iframe
- how to make my website secured
- How to correctly add Javascript to this PHP ‘Page Not Found’ Page?
- get taxonomy thumbnail and use it as a variable in code
- What are the advantages/disadvantages of using jQuery DOM manipulation as opposed to PHP DOM manipulation?
- element not working in Safari [closed]
- HTML escaping data with ajax requests
- Is it save to use eval for a jQuery callback method coming from the database?
- Get html data with javascript to php array and store to wordpress database
- 2nd page displaying the exact same posts as my first page (minus the very first post)
- Timthumb.php image gallery not working on Multisite WordPress
- An audio player that showcase a random song from playlist every 24h [closed]
- How to Change CSS Colors from Custom Plugin Settings Page
- Passing the name of selected color from the custom component to `render_callback`
- How to use wordpress function wp_enqueue_script() in php?
- How to allow download url redirection only if user logged in WordPress site?
- trying to get wp_get_attachment_url to output clickable link
- Get featured image with custom size outside WordPress
- How can I get my Media Uploader Button to function on 1 click rather than requiring 2 clicks?
- Images Uploaded saving onto older/previous year folders
- How to Make Thumbnail of Post Stay Animated
- CSS images don’t show up with bloginfo
- WordPress – Get Posts with Category data
- How to use wp_send_json() and output the value with ajax?
- How to store checkbox data for individual users?
- using shortcodes inside gravity forms
- WordPress Search Ajax + Isotope + InfiniteScroll
- WordPress User Meta value variable into Google Gauge Chart
- Change extension to .jpg when webp is not supported
- Prepend to all image URLs with PHP, only for mobile devices
- Gutenberg block don’t save rich text content
- Creating a POP Alert
- separate list of programs in html/javascript coming from php
- Hide Approved status for certain users in users list
- ACF values to Script with auto refresh
- Target a specific container to style on WordPress storefront theme
- How to include different html tags in the header for different pages?
- ACF + WP + Slick Slider Repeater Slide Group PHP not Displaying [closed]
- How to make sure, that only the selected post is changing?
- Default Image not showing up in Customizer for WP_Customize_Cropped_Image_Control
- How to create a radio button to alt between settings in wp_options table
- customizer live preview layout picker
- How do I routinely extract the thumbnail of the most recent post?
- I need help implement a Javascript code into the PHP file
- add class to background image
- Admin bar nodes
- My customizer’s setting doesn’t set to the default and needed to click the control’s “Default” button before it’ll be set
- How can I correctly POST to a WordPress page?
- Name Input from widget displays Sidebar name instead of saved data
- Changing 2011 theme header image based on user dropdown
- if is_home(), change class of menu-item-225 of wp_nav_menu
- Load php function with AJAX on modal window
- JSON Object Value Show Undefine
- Remove Woocommerce product from cart with ajax/fetch
- Add/alter image attribute before render
- WooCommerce Modal Fly cart on add to cart – With AJAX
- hiddenQuestions.find is not a function
- get_post_meta returns on side but it doesn’t return on bottom of admin page