Integration of JQuery Mobile into wordpress breaks linking to admin panels
-
Today I wanted to start building a new theme using JQuery Mobile, as a default, all links in JQuery mobile are loaded through AJAX, you would think this is awesome! But no… It isn’t compatible with WordPress for me… Maybe I’m doing something wrong, and there is a way to work around this. Here is how I included JQuery Mobile in my theme, I started with the BLANK Theme (can be downloaded here: https://themeclubhouse.digwp.com/. I’ve put the code below in the functions.php file, and copy pasted the JQuery mobile style definitions into style.css under the rest of the @media screen.
// Load jQuery if ( !is_admin() ) { wp_deregister_script('jquery'); wp_register_script('jquery', ("https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"), false); wp_enqueue_script('jquery'); } // Load jQuery Mobile if ( !is_admin() ) { wp_deregister_script('jquery.mobile'); wp_register_script('jquery.mobile', ("https://code.jquery.com/mobile/1.2.0/jquery.mobile-1.2.0.min.js"), false); wp_enqueue_script('jquery.mobile'); }
Now the problem starts, when trying to click on a link generated by WordPress, for example:
<?php edit_post_link('Edit this entry'); ?>
Or just any of the links of my admin bar even…now I believe the problem starts because of this AJAX loading by JQuery mobile(
https://jquerymobile.com/test/docs/pages/page-links.html) Here they say that multipage documents are indeed not working with the AJAX load, and need to be worked around using the rel=”External” attribute for links. Now these edit post links or any other admin panel link, are defined by wordpress outside my theme… and I don’t want to start messing with the source code made by wordpress.Now I could just generate the links differently inside my theme, but they also break the links from the standard wordpress admin bar. And that is a problem I wish to avoid.
SOOOO my question is: How can I integrate JQuery mobile in my theme? And avoid these admin links from breaking?
- The topic ‘Integration of JQuery Mobile into wordpress breaks linking to admin panels’ is closed to new replies.