Modify Wordpress Admin Area

Joined: 11/28/2008
User offline. Last seen 2 years 28 weeks ago.

I would like to edit an admin function of wordpress and before I spent my time swimming though lines of code, I thought I would ask here to see if anybody could save me that time.

I have a very strict directory structure that I adhere too. I keep any image that will be posted within my blog's post content in the directory: /images/posted/. I would like to modify wordpress so that when I click the add image button, the url is already prepopulated to point to this directory.

So when I click image, instead of seeing a popup with just "http://" prefilled, it would read: "http://www.paulhobson.com/images/posted/".

Has anyone modified their wordpress install in such a manner? If so, where can I find this code?

Joined: 11/28/2008
User offline. Last seen 2 years 31 weeks ago.
It's in

It's in wp-includes/js/tinymce/themes/advanced/editor_template.js, on line 245. You need to change the value of src to whatever you want to initially show up in Image URL. (If you can't find it, search the file for case "mceImage": - what you want to change is on the line below that.)

--- Mr. DOS

Joined: 11/28/2008
User offline. Last seen 2 years 31 weeks ago.
Well that's torn it. It looks

Well that's torn it. It looks like, as of WordPress 2.5, editor_template.js has been compressed with the YUI Compressor. I'm looking to see if I can't find another way around it.

Hmm, and now it looks like the "add image" functionality is completely broken, for me, at least... wonder why. Anyone else with 2.5 seeing this problem?

--- Mr. DOS

Joined: 11/28/2008
User offline. Last seen 2 years 28 weeks ago.
I've been poking around 2.5

I've been poking around 2.5 myself to try and find things. You could just rollback your changes...

Joined: 11/28/2008
User offline. Last seen 2 years 31 weeks ago.
Hmm, now here's an idea -

Hmm, now here's an idea - download whatever version of TinyMCE WP 2.5 uses uncompressed from the TinyMCE site, make the changes to the uncompressed file from it, run it through the compressor, and then replace the WP one with it. Lemme see here...

Nope, that's not going to work either, because the layout of the file has changed, and while I've found the new image adding function, I'm back to being stymied at not being able to play with the thing. Bummer. I'm going to check the WP website to see if anyone else is having my problem.

Later...

Found it! Well, the image adding button on TinyMCE isn't working, but that's OK, because I'd totally overlooked the new "Add an image" media button. So, to change the default URL in there, you're looking for line 1085 of wp-admin/includes/media.php. Specifically, you want this line:

CODE
<td class="field"><input id="insertonly[src]" name="insertonly[src]" value="" type="text"></td>

I'm sure you can figure out what needs to be changed? /wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" />

--- Mr. DOS

Joined: 11/28/2008
User offline. Last seen 2 years 28 weeks ago.
Ah! That was it Mr. Dos!

Ah! That was it Mr. Dos! Thanks. While I never meant for someone to do the code snooping for me, that's just what you did. I owe you one.

Joined: 11/28/2008
User offline. Last seen 2 years 31 weeks ago.
Not a problem /wink.gif"

Not a problem /wink.gif" style="vertical-align:middle" emoid=";)" border="0" alt="wink.gif" /> While I didn't really intend to go code snooping either, I was quite curious to see how it worked (that and, Crimson Editor makes file searching decently easy).

--- Mr. DOS