Hi everyone, I've solved one problem with embedding videos into blog posts, but it's created another. I use permalinks which contain the same name as the videos I want to post. So, to embed easily and dynamically with each page, I used the following command within my embed tag: <embed style="FILTER: xray" name="RAOCXplayer" src="<?php the_permalink()?>.wmv" </embed> Now, everything works great, except....the output is this: <embed style="FILTER: xray" name="RAOCXplayer" src="http://www.website.com/videos/this-is-my-video-name/.wmv" </embed> My question is, how can I strip that backslash (outlined in red) that occurs just before the file extension of .wmv without going into the "the_permalink()" function? There's gotta be a way. And I can't find where that function is located within WordPress. Any help would be appreciated. Thanks, boxer126
A couple ways, about about: src="<?php str_replace("/.wmv", ".wmv", the_permalink());?>.wmv" Or src="<?php stripslashes(the_permalink());?>.wmv"
Thanks for the suggestions Todd. I couldn't get them to work however. I believe stripslashes strips all the slashes in the string, which would destroy the file path and with str_replace, the end of the file wasn't /.wmv, it was just the slash. I was trying to strip that slash and replace it with .wmv. Anyway, the answer turned out easier than expected. WordPress has an option that allows you to format the permalinks. I simply removed the slash in the options menu. Without the slash, the permalink function provides the correct url and I just appended .wmv to the end of it. Thanks again, boxer126
The string replace didn't work because .wmv isn't part of the_permalink() the_permalink() = http://www.website.com/videos/this-is-my-video-name/ and the function is attempting to replace /.wmv with .wmv but there is no /.wmv in that string to replace for future reference, the easiest function to strip characters is substr() substr(the_permalink(), 0, -1) will remove the last character
Oh, I don't know how I didn't see the ".wmv" after the php, sorry lol >.< But yea, like gwkg posted doing this would work: src="<?php substr(the_permalink(), 0, -1);?>.wmv"