• I need to be able to swap the javascript ‘jQuery’ from each one of these pages to the other. The script that I need to swap is the drop down menu that appears when you click on the menu item. Any assistance would be greatly appreciated.

    This is the one page:

    [excessive code removed]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Could you post that to a pastebin – too much for here. Thanks!

    https://codex.www.ads-software.com/Forum_Welcome#Posting_Code

    Thread Starter GETPRO

    (@igetpro)

    Ok, sorry about that. Here are the links to the code if anyone can assist.

    Many Thanks.

    Page 1: https://pastebin.com/eqYQ2EJx

    Page 2: https://pastebin.com/vGutWiaF

    Moderator bcworkz

    (@bcworkz)

    Could you be more specific please? Both pages have jQuery code. Which is going where? Also please confirm what line numbers the code you want to move occurs at, I may have missed which code you’re really talking about.

    What are you actually trying to accomplish? Just moving the jQuery code to a different page will not work unless the same selectors are being used and the same referenced code is applicable. This is impacted by either calls to wp_enqueue_script() somewhere, possibly functions.php, or code on the header.php template.

    Finally, please provide links to these pages. Because of scripts, there’s more going on than what can be determined from the provided template code alone.

    Thread Starter GETPRO

    (@igetpro)

    Thanks for your reply,

    This is a project for a client that I have taken over mid build so I am still becoming familiar with it.

    They are menu items with the java applied to them and i want to swap them from one page to the other and vice versa.

    On https://pastebin.com/eqYQ2EJx it is line 118 and
    On https://pastebin.com/vGutWiaF it is line 193.

    I had a look at both header and functions and this was the only java in functions

    function mts_add_scripts() {
    	$mts_options = get_option('point');
    	global $data; //get theme options
    
    	wp_enqueue_script('jquery');
    
    	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
    		wp_enqueue_script( 'comment-reply' );
    	}
    
    	wp_enqueue_script('customscript', get_stylesheet_directory_uri() . '/js/customscript.js', array(), 'null', true);
    
    }
    add_action('wp_enqueue_scripts','mts_add_scripts');

    Here are the links to take a look.

    https://elitecolleges.com.au/colleges/
    https://elitecolleges.com.au/courses/

    Thanks for your help with this,
    Much appreciated.

    Moderator bcworkz

    (@bcworkz)

    Thanks for all the info, it was very helpful. I can see now that you need to know exactly which block of code to cut/paste in each file. In a straight across swap, the location link will then be in the middle and the category link will be on the right, assuming you paste into the starting location of the other code. These can be rearranged if need be, but let’s just get them swapped first to be sure everything works. Just in case, keep backups of the original files.

    Cut/paste these lines from vGutWiaF (Courses): 193-194, 195-231 inclusive, paste the first set at the start of the below extracted code, the other set after the `<li><a href=”/colleges/?college_feature=popular” alt=”Most Popular” >Most Popular</a></li>
    ` line (119) left from in between the extractions below.

    Cut/paste these lines from eqYQ2EJx (Colleges): 118 alone, 120-132 inclusive (119 remains), paste both as a contiguous block.

    I hope that’s right! It’s a little difficult to keep everything straight when I’m not actually doing the edits. Check the resulting output carefully, it’s possible some div tags are not properly matched. Even worse things could happen too. If that’s the case, you’ll need to post the latest code in pastebin and I’ll straighten it out for you.

    FYI, even though I completely understood your intent, you should not refer to javascript code as ‘java’. Java is a completely separate, unrelated language by Oracle. We are only using JavaScript and jQuery here, never Java ??

    Thread Starter GETPRO

    (@igetpro)

    Hey,
    Thanks for the information, I swapped the code that you spoke of and it worked for one page but not the category page. I must have got the “Javascript” (Thanks for the heads up) wrong somewhere as it was showing the menu item and showing the drop down box but the list was empty. Any suggestions? Could I maybe send you a copy of the two files and you can take a look?
    Thanks so much for your gracious help and assistance.

    Moderator bcworkz

    (@bcworkz)

    Yeah, sure, I’ll see what I can make of it. It’d be helpful if you create a page based on the broken template and send the link along with the file. You don’t have to worry about search engines picking it up as long as there is no link to it published anywhere. Send them to my gmail.com account, there I use “bcworks” with an S, not Z.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Swap the Javascript 'JQuery' over on two pages’ is closed to new replies.