需要一个类似于 mpora.com 的 WordPress 视频库插件

发布于 2024-12-02 08:12:46 字数 386 浏览 0 评论 0 原文

我有一个客户,我从头开始完成了一个 WordPress 主题的设计,该项目是一个互联网电视网站,虽然我找不到一个满足基本需求的像样的视频库插件,但我设计了该网站,并在研究后找到了 mpora,其中有我想要完成的确切方法,有人可以向我指出一个插件的方向或一种工作原理相同的主题方法...

http://video.mpora.com/snowboarding/

如果我可以将视频嵌入到可以分类的普通帖子中,并且他可以像普通博客一样添加附加信息,那就太好了帖子和主页上的缩略图显示在图库中,单击后将显示完整帖子。另外还可以将所有其他博客文章放在 /blog 下,

谢谢。

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 Decent 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

习惯成性 2024-12-09 08:12:46

您知道这并不难做到...

在您的模板的functions.php 文件中只需添加即可。

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;' ));

这将使您能够创建一个 single-{CATID-NUMBER}.php 文件,即

single-5.php

5 是名为“VIDEO”的类别,其 ID 为 5,但请确保更改此设置以匹配您的安装...

在此单打页面中,您可以使用自定义字段,将视频嵌入代码拉到该页面上...

<?php 
if ( get_post_meta($post->ID, 'VIDEOEMBEDCODE', true) ) : 
 echo get_post_meta($post->ID, 'VIDEOEMBEDCODE', true) 
else: 
 echo "No Video embed code...";
?>

然后再次在您的functions.php中使用

add_theme_support( 'post-thumbnails' );

,您可以启用帖子缩略图,只需使用它们和主页上的自定义wp_query即可使用帖子缩略图作为链接从该类别中提取视频列表?

<?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;
?>

使用 WordPress 几乎总有办法:)

!!!更新!!! - 在下面回答您的评论..

single-5.php 文件是在您的主题文件夹中创建的,然后 WordPress 将解释此文件并仅在类别 5(视频)的单个帖子正在运行时显示此页面查看,这只是为了让您可以拥有视频样式的页面,即看起来像 this ,这样你就可以设计你的常规帖子与视频页面的帖子不同...

要实现此目的,您将代码的第一部分添加到主题文件夹中的函数文件中。然后要使用内置的帖子缩略图,

add_theme_support( 'post-thumbnails' );

再次将该行添加到您的函数文件中,

然后在编写帖子或添加新视频时,您将像平常一样编写帖子,

  • 添加标题(视频标题)
  • 添加帖子内容(视频描述)
  • 将其添加到视频类别(5)

然后...

在您选择类别的右侧,您应该会看到一个新面板,名为特色图像,它是由添加 add_theme_support( '后缩略图');添加到您的函数文件中。

点击“设置特色图像”链接,

您的媒体浏览器将会出现,可以上传图像用作缩略图,也可以使用“FROM URL” >”在顶部,然后粘贴来自 youtube 的缩略图的链接,在图像属性详细信息部分,底部会有一个小链接,
用作特色图像”,单击此按钮会将图像添加为特色图像...

然后按照上面的其余信息操作:),使用模板文件中的 has_post_thumbnail() 来显示特色图片...

马蒂...

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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文