How to insert a video on the news page in the Revolution Theme

Continuing my process of passing on my experience of this theme and how to develop it, a question has been asked on how to insert a video into the template news page, in replacement of a picture and it is actually quite straightforward to do

The aim of this tutorial is to end up with this:

A video on the newspage


The best way to achieve this is to not use the wp-youtube plugin here. Rather you need to embed the code to call the youtube video into the space that is currently being used by the picture.

What you will need:

  1. Access to your Blog directory structure from an FTP client such as Filezilla
  2. Text editing software such as Notepad

Understand the style.css page

1) Firstly copy the style.css file from your server onto your computer and make a backup copy of it – just in case

2) Open it up in your favourite text editor and scroll down to the News Section, where you will see this code:

#newspage {
width: 920px;
margin: 0px auto 0px;
padding: 0px 0px 0px 0px;
line-height: 20px;
}

This means that the page is 920px wide. Scroll down a bit more and see this code:

#newspageleft {
float: left;
width: 280px;
margin: 0px 0px 0px 0px;
padding: 0px 20px 0px 0px;
border-right: 1px solid #C0C0C0;
overflow: hidden;
}

#newspagemiddle {
float: left;
width: 280px;
margin: 0px 0px 0px 0px;
padding: 0px 20px 0px 20px;
border-right: 1px solid #C0C0C0;
overflow: hidden;
}

#newspageright {
float: right;
width: 280px;
margin: 0px 0px 0px 0px;
padding: 0px 0px 20px 0px;
overflow: hidden;
}

If you take a look at the news page you will see that it is divded up into 3 sections: left, middle and right and that each of those sections has various atributes. This image may describe it more clearly:

The standard news page with explanations


So if you add all the dimensions (image width and padding) up you get 920px! It’s important to realise that this is the space you have to play with. Whatever you do it should always add up to 920 px wide in totality, to keep the nice clean lines.

Understand the page_news.php file

1) Firstly copy the page_news.php file from your server onto your computer and make a backup copy of it – just in case

2) Open it up and you will see this text at the top:

<div id=”newspageleft”>

<b>News Section #1</b>
<img src=”<?php bloginfo(‘template_url’); ?>/images/np-1.jpg” alt=”<?php bloginfo(‘name’); ?>” />

This is calling in the left handside section the image that is in the revolution/images folder called np-1.jpg. And it is this that needs to be changed. However it is worth understanding the other sections:

<?php $recent = new WP_Query(“cat=1&showposts=1″); while($recent->have_posts()) : $recent->the_post();?>
<b><a href=”<?php the_permalink() ?>” rel=”bookmark”><?php the_title(); ?></a></b>

<?php the_excerpt(__(‘Read more’));?><div style=”clear:both;”></div>
<?php endwhile; ?><br />

This is saying show some of the latest post in category 1 and just show 1 of them. You could if you wish replace ‘cat=1′ with cat=[whatever category you like] and will only show a post from that category. Scrolling on:

<b>Recent News Section #1 Articles</b>
<ul>
<?php $recent = new WP_Query(“cat=1&showposts=5″); while($recent->have_posts()) : $recent->the_post();?>
<li><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></li>
<?php endwhile; ?>
</ul>

This section is saying show 5 recent posts from category 1. As per the above you could change this cat=[whatever category]

Making the changes

1) Now that we have a clear understanding of what is going on, go to your page_news.php and locate this section:

<b>News Section #1</b>
<img src=”<?php bloginfo(‘template_url’); ?>/images/np-1.jpg” alt=”<?php bloginfo(‘name’); ?>” />

You will now need to replace it with this code:

object width=”280” height=”180“><param name=”movie” value=”http://www.youtube.com/v/EKGW9WH_0gM“></param><param name=”wmode” value=”transparent”></param><embed style=”margin-bottom:6px” src=”http://www.youtube.com/v/EKGW9WH_0gM” type=”application/x-shockwave-flash” wmode=”transparent” width=”280” height=”180“></embed></object>

The items in ‘red‘ can be changed to reflect the size of your player but remember that if you change the ‘280′ you will need to change the style.css file as well. The items in ‘green‘ are changed to reflect the youtube reference code

2) Once that is done upload the file and check to see if it has turned out as you wish.

Variables

1) You could of course make the videos bigger by removing say the middle column totally from the page_news.php and tweaking the red items as mentioned above (don’t forget to alter the style.css as well!)

Any comments let me know

show hide 11 comments

December 4, 2008 - 1:44 pm

Mark - I’ve been reading this page hoping for a solution for the Revolution Sports Mag theme but it looks like it is not. Probably you guys could give pointers on how to use WP Youtube instead of the built-in code in the theme itself?
Help greatly appreciated.

January 27, 2008 - 8:42 pm

Guy - Excellent work Jens, I’ll take a look

January 14, 2008 - 5:51 pm

Jens Törnell - WP YouTube 2 finally released! You can read and download it here: http://www.jenst.se/2008/01/13/wp-youtube-2

Here is an example of what you can do with it…

wpyoutube(‘green’,'YjYT5OLoR8U’);

This can be used if you created a profile called ‘green’. Feel free to try it out! :)

January 1, 2008 - 10:00 am

Jens Törnell - I’ve been working on version 2 of WP YouTube for the last 3 days and it is totally rewritten. There is still a lot of work to be done but at least I got the time to get started.

Right now I can create / delete unlimited number of “profiles”. One profile is one setting.

For example the profile named “blue” is 320×240px and uses the color blue. The profile named “green_small” is 100×100px and green.

That way I can later create a function that looks a bit like this:
wp-youtube(‘green_small’,'YjYT5OLoR8U’);

Happy new year! :)

December 13, 2007 - 9:22 am

Guy - Hi Jens

how goes the work?

December 5, 2007 - 5:40 pm

Jens Törnell - I now got the theme from Brian to test this. I’ve already started and now it’s possible to insert wpyt_static(“youtube_id”);?> for presenting a video directly into the theme.

My next step is to be able to use individual settings for it. =)

December 5, 2007 - 10:50 am

Jens Törnell - I wrote to Brian Gardner, now waiting for the reply. If I can try the feature with his theme it would be much easier to test it, to see if it works as intended.

I’ve had this feature in my head for some time, but I wanted to release WP YouTube as soon as i worked, to see if there was any interest. Now is the time to pump it with features. :P

I’ll write again when I got a reply from Brian.

December 5, 2007 - 10:05 am

Guy - Hi Jens

yes I think that that pretty much covers it. At the moment your plugin works when inserting it into a page or a post by ‘calling’ the widget function.

As wordpress is being used more and more as a CMS the option of calling it in other areas of the website, for those that like to play around with the php files and the style.css would be useful.

You may want to hook up with Brian Gardner who designed the theme – the pair of you may be able to work on something together?

December 4, 2007 - 8:34 pm

Jens Törnell - Thank you! =)

If there could be a feature in WP YouTube that solves this problem and at the same time can be useful in other themes, I would like to put something together.

I don’t have the Revolution Theme and as far as I can see that I have to buy it to try it out? That makes it a little bit difficult to see how you want it to work.

If I’m getting this right…
- You want an admin option, textfields where you can put 3 or more static YouTube ID-s?
- You want the static YouTube videos to have their own width and height? (not affected by the global WP YouTube settings)
- You want to call a function from template to get one of the static videos? Like

Is this how you want it to work? Is there any other problem that needs to be solved that I don’t know about? Then I’ll see what I can do about it.

Regards Jens

December 4, 2007 - 6:03 pm

Guy - Hi Jens

simply because I could not get it to embed properly into that section of the site and stay there.

Your excellent plugin is great for sidebars and other areas that call dynamic content. But in an area that has a fixed width (such as the News page section in question) then having the ability to globally change the wp-youtube height and width would negate this very good feature of your plugin.

If you can provide a different point of view on how it could work with the plug-in, then I would be very happy to incorporate it into the text.

I can of course also remove reference to the plug-in should you feel it incorrect, though the query I was answering made direct reference to it

http://support.revolutiontheme.com/viewtopic.php?t=50

Best
Guy

December 4, 2007 - 5:19 pm

Jens Törnell - Why could you not use WP YouTube for this?

/Jens

Your email is never published or shared. Required fields are marked *

*

*

There was an error submitting your comment. Please try again.