WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Admin Panel JQuery Includes (8 posts)

  1. Buckycat7
    Member
    Posted 5 years ago #

    I was adding some JQuery code to my blog them and keep getting this strange error that wouldn't let the JQuery work because of the JQuery file in the includes/js directory. So to see it it would fix the problem I changed the name of the JQuery directory and that fixed the problem in the blog theme.

    But now there is a minor thing in the admin panel because of the includes for the JQuery, I tried looking in a couple files but I couldn't find it. Can someone tell me where I need to change the javascript jquery sources that are in the admin panel header?

  2. Doodlebee
    Member
    Posted 5 years ago #

    You already did that. The js in the includes directory is for your admin area. If you want your *theme* to use js, then you're supposed to create a file within your theme directory, and call it in through your theme files.

  3. Buckycat7
    Member
    Posted 5 years ago #

    You aren't understand the problem, I called a js file in the header of my theme and for some reason it still defaulted to the JS include directory. That thats not here or there.

    If you view the source why you are editing a post or page there is a long list of script tags calling different js files. I just need to know were I can edit those paths because I was unable to find it after digging through the files from the wp-admin directory. So it's not fixed.

  4. Doodlebee
    Member
    Posted 5 years ago #

    I didn't say it was fixed. What I said was that the js stuff in the /includes directory is for the *admin* area. if you edited the js stuff that's inside the includes directory so the jQuery for your *theme* would work, you've just messed up your admin area (which, as per your question, you did.)

    if there was an error in the jQuery for your *theme* them there was an error in that jQuery code that needed to be fixed. You shouldn't have gone into the jQuery for the *admin* area (which is located in the /includes folder) and tried to mess with that. What you should have done is tried to fix the *theme* related jQuery code that belongs in your theme folder.

    i.e. you fixed the wrong code, and messed it all up.

    at least that's what I'm getting from your question - that the jQuery you were using for your theme wouldn't do what it needed to do. You say it kept "defaulting to the includes directory" - that sounds to me like you either put the code in the wrong place, or you didn't use the right call in your header to find the file. So yes, it is here or there.

    What you need to do now is reupload the files you messed with in the includes folder, and revert them back to what they were. Then figure out why the jQuery you put into your theme header was getting the error it was getting - rather than trying to rewrite WordPress.

    When you're working with the theme files, you stay in the wp-content/themes folder. You don't go poking around in core code...you're just asking to bang your head on a brick wall.

  5. Buckycat7
    Member
    Posted 5 years ago #

    Okay, see if you could explain this. The JQuery code that I added to the work just fine anywhere out side of WordPress. I build the script, coding and styling on my local computer. But when I went and added the code into WordPress all of the scripting was mess up because, like I stated above JQuery code started pulling the from that includes file. Yes I double check all the paths, so that is what started the problem.

  6. Doodlebee
    Member
    Posted 5 years ago #

    Well, WordPress and a static HTML site are two different things. There's many things that could have gone wrong. I don't know what you were trying to do, nor do I know what errors you were getting )you haven't supplied any of that information) it could be that your static code was making calles with relative paths - that woudl be wrong, because wherever you are on your WP site, the relative path would change it would be right for one page and wrong for all others. it could be that you were trying to use something that conflicts with the core code. Who knows? You haven't really told us much - save you were getting errors, and you think it would be best to rewrite core WP code than to try and figure out what's conflicting with *your* code. but yes, you *can* have stuff working on a regular HTML site that will break using WP. That's why, when you develop for WP, and you don't want to do it in a live site, you have a testbed environment (either online or localhost) to do so.

    To answer your original question, you will have to wade through all of the files in WordPress - starting with the JS stuff, to figure out where these things need to be changed. I'd put money on it that when you do, other errors will pop up related to the changes you just made, and you'll wade through and try to fix those...in an endless cycle. OR you could just try and figure out why your original code is conflicting with WordPress. Fix your code - there's nothing wrong with WP.

  7. Doodlebee
    Member
    Posted 5 years ago #

    gah - double-post...sorry

  8. Buckycat7
    Member
    Posted 5 years ago #

    I figured it out, it was a plugin that was calling the JQuery include, but again for some reason the file is was calling was causing errors with all other JQuery used in the theme.

    Thanks for the information and help.

  9. alsd
    Member
    Posted 5 years ago #

    Does this mean I cannot use the jquery files directly from the include folder for my theme? If yes, how do I call the files? Can't find answer from google search nor codex.

    Since WordPress already bundled jQuery, it doesn't make sense to create a duplication in my theme folder.

Topic Closed

This topic has been closed to new replies.

About this Topic