• Resolved moltra

    (@moltra)


    I have a website I am working on and I am trying to create a custom child theme. I have a html version of the theme working on a test server, but when I split the CSS, javascript out and place them in a custom child theme and place the html in a post. I show the javascript being loaded, but the page is not working properly. It looks like the javascript is not being called.

    Any advice or help would be appreciated.

Viewing 12 replies - 1 through 12 (of 12 total)
  • stephencottontail

    (@stephencottontail)

    You mentioned you were using a child theme; what parent theme are you using? Can you post a link to a page that shows the issue? If you use Firebug or some other web inspecting tool, do you see any JavaScript errors? Are you using jQuery?

    Thread Starter moltra

    (@moltra)

    I am creating the child theme based on Stanleywp theme.

    I have used the chrome dev tools and no error is showing up.

    Here is the function in my functions.php file that I use to call the javascript.

    function theme_js() {
    
    	wp_enqueue_script( 'theme_js', get_stylesheet_directory_uri() . '/js/placeloc.js', array( 'jquery' ), '1.0', true );
    
    	wp_enqueue_script( 'gmap', '//maps.googleapis.com/maps/api/js?key=keyremovedY&libraries=places&callback=initMap', array ('jquery'), '1.0', true );
    }
    
    add_action('wp_enqueue_scripts', 'theme_js');
    add_action('wp_enqueue_script', 'gmap');
    
    ?>

    Basically I am trying to get a google places autocomplete hotel search javascript to work in wordpress.

    https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-hotelsearch

    [excessive code moderated]

    Thread Starter moltra

    (@moltra)

    I created a reply, I guess it is being moderated?? If it does not show up, I will create a new reply with the info in it.

    But no errors in chrome dev toolbox, and yes I am using jquery.

    The one I posted had a link in it, maybe that is causing the moderation?

    • This reply was modified 8 years ago by moltra.
    stephencottontail

    (@stephencottontail)

    It’s hard to say exactly what might have gotten you flagged, but I went ahead and released your post from the spam queue and removed the excessive HTML, as well. Can you post a link to a page that shows the issue, and not the HTML itself?

    Thread Starter moltra

    (@moltra)

    Yes, I will setup a VM server tonight on a cloud service. Currently the server that the page cannot be accessed from online.

    • This reply was modified 8 years ago by moltra.
    Thread Starter moltra

    (@moltra)

    I think I am just going to have a custom plugin / theme created. I have been trying to get this working on and off for over 2 months.

    Thanks for your help.

    Thread Starter moltra

    (@moltra)

    I am still trying to figure out how to get this to work.

    I have a test server setup at https://104.236.207.225/

    I am getting the following error.

    message
    :
    “initMap is not a function”
    name
    :
    “InvalidValueError”
    stack
    :
    “Error?

    Thread Starter moltra

    (@moltra)

    stephencottontail

    (@stephencottontail)

    I just went to the server you set up at 9:25am Mountain time and I don’t see the Google Maps scripts being loaded. Did you use the same code you posted over at StackExchange to load the scripts when you set up the test server?

    Thread Starter moltra

    (@moltra)

    yes I did, but there has been slight changes due to troubleshootin.

    stephencottontail

    (@stephencottontail)

    Can you post the code you’re using on the test server? If there’s more than 20 lines or so, please use Pastebin and post the link here instead.

    Thread Starter moltra

    (@moltra)

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘child theme, not working javascipt’ is closed to new replies.