I have a made a small jQuery script to import values from other file and insert this values in WordPress POST page as Custom Meta Tags.
When I Create A New Post the form is shown below the Post content area and every thing works 100%.
The problem is if I press "Edit Post" Button/link then it loads the Post Edit page but nothing is shown. Just a White screen loads, so I cant Edit this Post.
Here is my Script:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
<input name="file" type="text" id="file">
<script type="text/javascript">
$(document).ready(function() {
$('.button').click(function() {
var val = $('#file').val();
$.get('import.php', {file: val}, function(data) {
result = $.parseJSON(data);
$("input[name='nick_name']").val(result.name);
$("input[name='work_city']").val(result.location);
});
});
});
</script>
<input type="button" class="button" value="GET/IMPORT">
I also tried to add this script (after jquery.min.js):
<script type="text/javascript">
$.noConflict(true);
</script>
Then Edit Post page worked but I could not use my custom form/button.
My question is: How can I load this Script without getting any conflict with WordPress Edit Post page?
If I remove:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
From my script then All pages load OK but then my custom made form/button don't work.
LATEST UPDATE: I GOT IT WORKING :D :D :D Just testing when or where I should load this script to get my results successfully. I started editing /wp-admin/admin-header.php (I know its NOT recommended to edit CORE files but Im just doing it for debuggig!) First of all I inserted the jQuery script that Im using on Line 1 before opening of
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
Then I went to POST NEW page, I could see some different in font sizes but the function I wanted was there, I could use my button. So I opened EDIT POST page and I could see the EDIT PAGE! Now EDIT PAGE is working also. Finally I figured out if I insert this jQuery script in beginning on LINE 59 in /wp-admin/admin-header.php
then every thing works 100% :D The design CSS looks good and the functionality is there!
Now I need help to insert/paste this script to LINE 59 in admin-header.php How can I do that using functions.php?