- This topic has 4 replies, 2 voices, and was last updated 8 years ago by .
- The forum ‘General Discussion’ is closed to new topics and replies.
These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.
I found a simple snippet to add line numbers to the left side of the text area in WP admin. Comes in handy.
I know how to upload the .css and .js file, but 2 questions:
1. into what directory do the files get uploaded
2. where do I place the code as mentioned in this step:
Installation: Copy the files to your web server and insert the .js and .css file and you are good to go. Requires JQuery 1.3+
The piece of script provided was this:
// Target all classed with ".lined"
// Target a single one
Does this go in the admin file called post at the top?
Where does the .css file go?
Don't want to break my site.
I'd recommend placing the files in a custom plugin because this is likely something you'll want to maintain even if you switch themes. Here's a link to a post I wrote on how to do it.
You can create whatever directories you want or just put everything in the root. The important thing is that you make sure your paths are correct when you include/enqueue any files.
So I just copy the script above into a .php file as you stated on your post, then upload the 2 files making sure they are referenced correctly in the script (per your post), then upload the .js and .css file? How do I activate the code then?
It looks like you'll need to do the following:
1. Download the files and include them in the plugin;
2. Create a new js file to instantiate (create a new instance of) the script
3. Enqueue the scripts and stylesheet in your main plugin file
From there, you would activate the plugin like any other plugin (upload the zip file via the plugin installer). Just make sure to include the proper heading.
Hopefully this helps. If you're not comfortable with doing all that, you can hire a developer or do some research on integrating JS plugins with WordPress so you can see other examples on how it's done.
I thought I said a 'thank you' for this code - looks like the post didn't get published at that time, so thanks for the input. Appreciated.
© 2023 WPEngine, Inc.