I've been a web developer for a long time but always custom coded everything. This is my first attempt at wordpress and I just bought the beautiful theme.
What is the best practice for handling custom scripting (php) on a single page? For example... where do i place scripts? Do I need to make a page template? If so how? When I look at the existing templates all I see is:
I'm trying to create a page like : http://mygroovysite/video/xyz123abc
What I'm trying to make happen is the page template "video" is loaded and then a youtube video with id "xyz123abc" plays.
I've done this numerous times before on my own custom sites so scripting is not the problem, it's understanding the best practices in the world of wordpress that I need help with.
I know somebody is going to post a link to some youtube plugin but to be honest I'm yet to see a plugin do precisely what I'd like it to.
If you're referring to PHP, you have 2 choices.
1. Add the code directly to a template file
2. Add a conditional tag after the function in your child themes functions file.
add this to my child theme? I'm using "beautiful".
will this break updates?
1. when i open page.php template all i see is: genesis(); not sure how to add php here? wouldn't the scripts results get added after or before the page and not inside the page?
2. can you provide an example please? not sure what "the function" means.
(I'm brand new to wp )
I'm afraid it's a local instance. I'm just getting the feel for wordpress and genesis locally before I dare port it live.
@bionary, what is the behavior that you want, exactly?
In WordPress, you can just put the URL to a YouTube video directly in a post or page (using the text editor) and it'll load the player right there, with no iframe or special coding required. It won't start playing the video automatically when the page is loaded though. Is that what you are trying to do?
Also to answer your original question: You can insert custom PHP code in any template file - before the genesis() function - here's a simple tutorial that shows how (which happens to load some videos too):
ah, ok thanks.
You must be logged in to reply to this topic.
Subscribe to get early access to new themes, discounts and brief updates about what's new with StudioPress!