I have a client that i have completed a design from scratch and wordpress theme, the project is an internet TV website, although im falling short on finding a Dec开发者_高级运维ent video gallery plugin that meets basic needs, I designed the site and after researching found mpora, which had the exact method i was trying to accomplish, can someone point me in the direction of a plugin or a method of theming that works the same...
http://video.mpora.com/snowboarding/
It would be superb if i could embed a video into a normal post that can be categorized and he can add additional information like a normal blog post and on the homepage have the thumbnail displayed in a gallery, when clicked takes to the full post. plus be able to have all other blog posts under a /blog
Thanks.
You know this isnt that hard to do...
in your functions.php file for your template simply add.
add_filter('single_template', create_function('$t', 'foreach( (array) get_the_category() as $cat ) { if ( file_exists(TEMPLATEPATH . "/single-{$cat->term_id}.php") ) return TEMPLATEPATH . "/single-{$cat->term_id}.php"; } return $t;' ));
this will enable you to create a single-{CATID-NUMBER}.php file, ie
single-5.php
5 is the category called 'VIDEO', which has an ID of 5, but make sure you change this to match your install...
within this singles page you can use custom fields, to pull your video embed code onto that page...
<?php
if ( get_post_meta($post->ID, 'VIDEOEMBEDCODE', true) ) :
echo get_post_meta($post->ID, 'VIDEOEMBEDCODE', true)
else:
echo "No Video embed code...";
?>
then using
add_theme_support( 'post-thumbnails' );
within your functions.php again, you can enable post thumbnails, simply use those and a custom wp_query on your home page to pull a list of videos from that category using the post thumbnails as the link?
<?php
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query();
$wp_query->query('cat=5&showposts=10');
while ($wp_query->have_posts()) : $wp_query->the_post();
?>
<div class="videobox">
<?php the_title();?>
<?php if ( has_post_thumbnail() ) { ?>
<img src="<?php the_post_thumbnail();?>"/>
<?php }else{ ?>
<img src="<?php bloginfo('template_url');?>/images/blank_video.jpg" />
<?php } ?>
</div>
<?php
endwhile;
$wp_query = null;
$wp_query = $temp;
?>
with wordpress theres nearly always a way :)
!!!UPDATE !!! - To answer your comment below..
The single-5.php file is created inside your theme folder, then wordpress will interpret this file and shows this page only when a single post from the category 5 (Video) is being viewed, this is only so you can have a Video styled page, ie so it looks like this, and so you can style your regular posts differently from that of your video pages...
To achive this you add the first section of code to your functions file also in your theme folder. then to use the in-built post thumbnail, add the line
add_theme_support( 'post-thumbnails' );
to your functions file once again,
then while writing a post, or adding a new video, you would write a post as notmal,
- Add the title(Video Title)
- Add post content(video Description)
- Add it to the Video Category(5)
Then...
On the right hand side under where you pick the category you should see a new panel, called FEATURED IMAGE, this is created by adding add_theme_support( 'post-thumbnails' ); to your functions file..
click on the "set featured image" link,
Your media browser will appear, either upload an image to use as the thumbnail or use the "FROM URL" up top, and paste in the link to the thumbnail ie from youtube, and in the image property details section, there will be a small link at the bottom, "USE AS FEATURED IMAGE", click this and that will add the image as the featured image...
then follow the rest of the info above :) using the has_post_thumbnail() within your template file to show the featured images...
Marty...
精彩评论