jquery 滑块和 wordpress

发布于 2025-01-05 22:14:42 字数 2381 浏览 0 评论 0原文

我对 wordpress、html、css 和 javascript 很陌生,如果可能的话,希望得到您的帮助:

我正在尝试为我的博客的特色内容区域创建一个双滑块,其中左侧将有三个特色 YouTube 视频滑块,以及右侧滑块上的帖子摘录。 这是我的想象。

我认为我目前这样做的效率很低;使用 dualslider

现在,我在右侧面板上有三个 div,每个帖子对应 the_excerpt() 所在的位置在每个 div 中输出:

<div class="detail" >
      <?php $args=array('tag' => 'Featured1', 'showposts'=>1, 'caller_get_posts'=>1);
               $my_query = new WP_Query($args);
                      if( $my_query->have_posts() ) 
                {
                      while ($my_query->have_posts()) : $my_query->the_post(); ?>
                      <p><a href="<?php the_permalink() ?>" <?php the_title(); ?></a></p>
                      <h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a>

                      <h3><?php the_excerpt(); ?></h3>
                        <?php endwhile;
                }
                      wp_reset_query(); ?>
</div><!--END detail1-->

左侧三个 div,每个视频一个,其中 the_content 输出到每个 div:

<div class="detail" >
      <?php $args=array('tag' => 'Featured1', 'showposts'=>1, 'caller_get_posts'=>1);
               $my_query = new WP_Query($args);
                      if( $my_query->have_posts() ) 
                {
                      while ($my_query->have_posts()) : $my_query->the_post(); ?>
                      <p><a href="<?php the_permalink() ?>" <?php the_title(); ?></a></p>
                      <h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a>

                      <h3><?php the_content(); ?></h3>
                        <?php endwhile;
                }
                      wp_reset_query(); ?>
</div><!--END detail1-->

我想要精选的三个帖子分别标记为Featured1、Featured2 和Featured3,帖子内容只是 iframe youtube 嵌入代码,后面是我想要出现在正确内容面板中的任何内容。

最后,除了由于我不太了解 Dualslider javascript 文件而很难格式化视频的轮播大小之外,我的另一个问题是,当您从一张幻灯片移动到另一张幻灯片时,我需要暂停当前正在播放的视频,类似于AnythingSlider (http://css-tricks.com/examples/AnythingSlider/#panel1-4) 中提供的功能。

任何帮助将不胜感激。谢谢!

I'm pretty new to wordpress, html, css, and javascript and would love your help if possible:

I'm trying to create a dual slider for the featured content area of my blog where there will be three featured youtube videos on the left slider, and the post excerpt on the right slider. Here's how I picture it.

I think i'm doing this inefficiently at the moment; using dualslider

Right now I have three divs on the right panel, one for each post where the_excerpt() is being output in each div:

<div class="detail" >
      <?php $args=array('tag' => 'Featured1', 'showposts'=>1, 'caller_get_posts'=>1);
               $my_query = new WP_Query($args);
                      if( $my_query->have_posts() ) 
                {
                      while ($my_query->have_posts()) : $my_query->the_post(); ?>
                      <p><a href="<?php the_permalink() ?>" <?php the_title(); ?></a></p>
                      <h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a>

                      <h3><?php the_excerpt(); ?></h3>
                        <?php endwhile;
                }
                      wp_reset_query(); ?>
</div><!--END detail1-->

And three divs on the left, one for each video where the_content is being output to each div:

<div class="detail" >
      <?php $args=array('tag' => 'Featured1', 'showposts'=>1, 'caller_get_posts'=>1);
               $my_query = new WP_Query($args);
                      if( $my_query->have_posts() ) 
                {
                      while ($my_query->have_posts()) : $my_query->the_post(); ?>
                      <p><a href="<?php the_permalink() ?>" <?php the_title(); ?></a></p>
                      <h3><a href="<?php the_permalink() ?>"><?php the_title(); ?></a>

                      <h3><?php the_content(); ?></h3>
                        <?php endwhile;
                }
                      wp_reset_query(); ?>
</div><!--END detail1-->

The three posts that I want featured are each tagged Featured1, Featured2, and Featured3, and the post content is just the iframe youtube embed code followed by whatever I want to be in the right content panel.

Finally, aside from it being difficult to format the carousel size of the videos given i don't really understand the dualslider javascript file, my other problem is that I need the currently playing video to be paused when you move from slide to slide similar to the functionality provided in AnythingSlider (http://css-tricks.com/examples/AnythingSlider/#panel1-4).

Any help would be much appreciated. Thanks!

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

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

发布评论

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

评论(1

酒儿 2025-01-12 22:14:42

试试这个...

https://gist.github.com/1848388

我已经添加了查询并将 php 循环到 index.html 演示文件中。

这是我下载的演示包... 双滑块演示文件

我还没有测试过所以它可能不起作用哈,我已经调整了您的查询以检索带有“精选”标签的最新 3 篇帖子。

也不要使用 对于图像或视频,为什么不使用自定义字段,这样您仍然可以在帖子中拥有完整的文章内容。

如果您使用 对于滑块中的特色图像或视频,那么您的所有帖子内容都将输入到该区域,如果您的帖子中有大量文本和其他图像,这可能会很痛苦。

因此,我已将自定义字段包含在我的 gist 中,替换 ,您所要做的就是创建一个名为...

滑块特色图像

自定义字段...并将图像代码或视频嵌入代码粘贴到其中。创建此自定义字段后,滑块特色图像将被保存,您将能够从其他功能的帖子编辑器的下拉列表中选择它。

我已经对 gist 进行了评论,所以你知道发生了什么。

祝你好运

Try this...

https://gist.github.com/1848388

I've added the query and loops php into the index.html demo file.

This is the demo pack I downloaded... Dual Slider Demo File

I have not tested it so it may not work ha, and I've adjust your query to retrieve the latest 3 posts with the tag 'Featured'.

Also instead of using <?php the_content(); ?> for the image or video, why not use a custom field, this way you can still have the full article content in your post.

If you use <?php the_content(); ?> for the featured image or video in the slider, then all your post content will feed into that area, which could be a pain if you have lots of text and other images in your post.

So I've included the custom field in my gist, replacing <?php the_content(); ?>, all you have to do is create a custom field called...

Slider Featured Image

...and paste the image code or video embed code into this. Once you've created this custom field, Slider Featured Image will be saved and you will be able to select it from a dropdown in the post editor on other features.

I've commented through out the gist so you know whats going on.

Good luck

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