How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Brandon M. Your Own Question

Brandon M.
Brandon M., Web Designer
Category: Programming
Satisfied Customers: 6977
Experience:  Web Design for 10 years, HTML, XML, PHP/MySQL, Perl, JavaScript, CSS
12024030
Type Your Programming Question Here...
Brandon M. is online now
A new question is answered every 9 seconds

Ive embedded hundreds of sound files as "link to media file"

This answer was rated:

I've embedded hundreds of sound files as "link to media file" and I play them with a plugin player called Haiku. It's lovely, but the cross platform and browser support isn't so wonderful. I'd like to change all our sound files to reference the native media support from wordpress, by changing all of the "link to media file" links to be "link to media player" links- which would bypass the plugin (which I could disable) and allow for native wordpress media support. An example of the two players can be found here: http://www.dialectsarchive.com/wp-admin/post.php?post=14854&action=edit

Do you know of a plugin or method to alter this across an entire site?

Brandon M. :

Hello and thank you for contacting us, a paid expert support site. My name is XXXXX XXXXX I'd be glad to assist you with your issue.

Brandon M. :

Sorry that link is protected as I would need an admin login to view. Is the difference between the two just a change in short code?

Customer:

yeah

Customer:

sorry, man

Customer:

that's protected?

Customer:

oh, sorry i sent you a link from the admin window

Brandon M. :

No worries. I am using Safari on a Mac and only see one player there

Brandon M. :

It's black in color

Brandon M. :

(I assume the Quicktime player)

Customer:

i just took out the old player

Customer:

that new player is the native media player

Brandon M. :

Ok, so yes, I see the native player.

Brandon M. :

So, if it is just a change in short code, it might be an easy fix directly through the database

Customer:

i believe it is just a change in short code, but across the entire site

Customer:

ok

Brandon M. :

Can you paste me a sample of both codes for the same file?

Customer:

yes

Customer:

from the "text"/code perspective it looks like

Customer:

[audio mp3="http://www.dialectsarchive.com/wp-content/uploads/2013/10/northcarolina21.mp3"][/audio]


<a href="http://www.dialectsarchive.com/wp-content/uploads/2013/10/northcarolina21.mp3">northcarolina21</a>

Customer:

the first being the native

Customer:

the second referencing the file as a link

Brandon M. :

Ok, so we are going from the second code to the first, correct?

Customer:

yes, sir

Brandon M. :

And I assume they are all MP3s?

Customer:

ummmm

Customer:

yes

Customer:

every single one

Brandon M. :

Great. Let me see what I can come up with - and do you have access to the database through your web panel or PHPMyAdmin?

Customer:

yep, cpanel to phpmyadmin

Customer:

i'm shocked there isn't a plugin to do this already

Brandon M. :

There might be but I am used to doing things directly. Programmer's mind, I guess... Haha

Customer:

cool, let me know

Brandon M. :

Ugh, can't use regex in MySQL Replace()

Brandon M. :

Would you be willing to give me a dump of your database or at least the table of posts and I can replace the strings using an external program?

Customer:

Sure

Customer:

gimme a minute

Brandon M. :

Great. Once you have it, please upload it to Wikisend: http://www.wikisend.com/ or your preferred file sharing site.

Brandon M. :

If you use wikisend, please provide the File ID so that I can download it.

Customer:

i might need a little help in this- I've never done it

Customer:

one sec

Brandon M. :

No worries - go to the posts table under the database on the left and use the Export tab on the right-side. You can then export the table - it will either give you a .sql file or a .gz file.

Customer:

ok

Customer:

i'm in finally

Customer:

looking at php my admin

Customer:

showing me three databases

Brandon M. :

Might be the second one, wrd1

Brandon M. :

Under it, do you have something like wp_posts listed?

Customer:

i think our primary databse is the first

Customer:

but i'll look

Customer:

i don't know why the f**k that wp_1 is there

Customer:

they both have posts options

Customer:

but wp_3 has all my plugins

Customer:

ahhhh

Customer:

_dialectsarchive has everything you need I think

Brandon M. :

Ok, whichever you think is the right one - depends on your setup, really.

Customer:

so quick export JUST the posts?

Brandon M. :

If you are entirely unsure, check your website via FTP or file manager from cpanel and look in the wp_config.php file

Customer:

wp_posts?

Customer:

just export wp_posts?

Brandon M. :

It will tell you what database it is using.

Brandon M. :

Yes, just wp_posts is fine

Customer:

sorry, it's doing the entire thing

Customer:

one sec

Brandon M. :

Its ok if you do the entire thing, I can just pull out wp_posts.

Brandon M. :

If you go to the wp_posts table first, you can export just that table

Customer:

getting wp_posts.sql now

Customer:

is that what you want?

Brandon M. :

Yup

Customer:

k

Customer:

i was going to use we transfer

Customer:

or whatever

Customer:

do you have an email

Customer:

or tell me how you'd like to upload

Customer:

nevermind

Customer:

i'm doing wikisend like you asked

Customer:

ummm too big i guess?

Customer:

email so i can use wetransfer?

Brandon M. :

I don't have a public email address, sorry.

Brandon M. :

Wikisend supports up to 100 MB.

Customer:

well the file won't upload there

Brandon M. :

How big is the file?

Customer:

one sec i'll check

Customer:

only

Customer:

45.1

Customer:

i'll try a couple more times

Customer:

We are sorry, but an error has occured while uploading.


You can return to the start page and try again.

Customer:

weird

Customer:

throw me an alternate place to do this please

Customer:

zippy share it is

Customer:

http://www12.zippyshare.com/v/12085532/file.html

Customer:

there we go :)

Brandon M. :

Ok, give me a little bit to do the replacements.

Customer:

cool

Brandon M. :

Ok, sorry that took so long.

Brandon M. :

Here is the updated file. 6207 replacements! https://www.dropbox.com/s/muchv0e93rqhib8/wp_posts-updated.sql

Brandon M. :

What you'll want to do is go into the wp-posts table in phpmyadmin, in the import tab, you can upload the file back in. (hopefully your host allows large files to be uploaded!)

Brandon M. :

It will drop the old table and replace it with the updated table.

Customer:

ok

Customer:

ummm, let me put up some notice and do that

Customer:

so, this won't mess up anything else, yeah?

Customer:

:)

Brandon M. :

Nope and if it does, you have the backup of the old posts table.

Brandon M. :

Sorry for the delay, I didn't see your reply.

Customer:

ok...

Customer:

so i think this is working

Customer:

i'm taking off our site warning and letting a few people test it

Customer:

and then i'll be paying you in a hot second

Brandon M. :

Okies, take your time

Brandon M. :

Just checking in - I'm going to need to step out soon. Just wanted to see how things were going. Not trying to rush or anything.

Brandon M. :

I will be back in a little bit.

Customer:

New is in. Working. Thanks! I'll pay now.

Brandon M. and other Programming Specialists are ready to help you