0

Sorry if this is a dumb question, I'm new at this... I want to remove one line from the main.js file without editing the theme file (to keep it updateable).

How can I remove this line? with a custom javascript plugin maybe?

$('#footer-menu ul li').not(':last').append('/');
1
  • I don't use Wordpress, so I don't entirely understand the update issue, but couldn't you just comment the line out? Commented Aug 16, 2013 at 19:54

2 Answers 2

2

You cannot edit a javascript file without editing a javascript file.

If you are altering another theme, the best way to do this is to create a child theme. That way you can inherit the base styles of the theme that you want, but you won't risk overwriting your modifications when you update WP.

Sign up to request clarification or add additional context in comments.

Comments

0

You could remove the slash:

var elements $('#footer-menu ul li').not(':last');
elements.each(function(){
    var text = $(this).text();
    $(this).text(text.slice(0,-1));
});

The best thing to do, however, is to see if your theme is using the wp_enqueue_script function. If it is, you can wp_deregister_script the javascript file in your function.php file and add your own version of the file.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.