• 2 things happened at nearly the same time, so I don’t know cause/affect.

    Problem:
    1) some, not all, text widgets went missing and/or relocated to the wrong sidebar
    2) WP dashboard, Appearance indicates parent theme is missing.
    3) WP dashboard, Appearance -> Customize seems to revert widgets/sidebars to broken state, after successfully re-edited.

    Changes:
    1) auto install of WP 4.2.4
    2) I added an inline reference to an external javascript to create a google map in a post, using as a guide:
    https://codex.www.ads-software.com/Using_Javascript
    added the following inside :

    <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false" type="text/javascript">
    </script>
    <script src="/wp-content/uploads/scripts/contactMap.js" type="text/javascript"></script>
    <script type="text/javascript">// <![CDATA[
    buildMap();
    // ]]></script>

    NOT CHANGED:
    Theme or Child Theme.

    Questions:
    1) Is using inline <script> for external javascript acceptable? I chose that method over wp_enque_script() because it was easier to understand. Externally, the page looks fine … now that I put the widget pieces back together.

    2) How do I fix the Parent theme status of missing in dashboard? I see the parent beside the active child theme in Appearance? Would a WP upgrade break parent theme? Would my javascript reference?

    3) How do I get past the Appearance->Customize reverting my widgets/sidebars to a broken state?

    Page in question: Contact-Us

    Site has not gone live yet. Was supposed to do that yesterday when all this went wrong. I don’t want to push live until I know that I have a clean start. Please help. Thank you.

Viewing 1 replies (of 1 total)
  • I think its unlikely that the Javascript has caused all that trouble. To check, temporarily remove it.

    Next I would temporarily deactivate all plugins. If normal behaviour resumes, reactivate plugins one-by-one to try to identify the one that’s causing the problem.

    If the problem remain with just WordPress and your theme in the loop, consider asking the theme vendor for support. They know their theme best and support is usually included in the cost.

    Regarding where to put the JavaScript, if it works inline, then it works. Its just a bit vulnerable to being changed inadvertently in my view.

    You already have a child theme, so the code in functions.php to add it is:

    <?php
      add_action( 'wp_enqueue_scripts', 'add_my_script' );
      function add_my_script() {
        $my_page_id = 114; // contact us page id
        if ($my_page_id == get_the_id() ) {
           wp_enqueue_script( 'my-js', '/wp-content/uploads/my_script.js', array(), "1", true);
        }
      }

Viewing 1 replies (of 1 total)
  • The topic ‘Coudl Javascript in Post break Appearance?’ is closed to new replies.