Home › Forum › Customization › Video Instead of Slider?
This topic contains 19 replies, has 2 voices, and was last updated by StartupWP 5 years, 10 months ago.
- AuthorPosts
- April 22, 2013 at 7:00 PM #675
Hello,
Is there a way to use a single video in place of the slider on the home page only? Or place a video in a single slide only? Then have the default page template display below? With no slider or video on any other page (except for home)? All other pages will use the default page template.
Thank you.
April 23, 2013 at 7:41 AM #678You’ll need to setup a child theme:
https://startupwp.com/topic/child-theming/
And copy over header.php from the main theme.
Find this line:
<?php if ( $options['slider'] ){ echo '<div id="slider">'.do_shortcode('[nivoslider slug="slider"]').'</div>'; } ?>
And replace with:
<?php if ( is_home() ) {echo 'YOUR VIDEO CODE HERE';} ?>
April 24, 2013 at 5:33 PM #682o.k. I did exactly as you said and nothing shows up. I thought html5 can play native video? Code below. Please advise.
<?php if ( is_home() ) {echo ‘<video poster=”/wp-content/uploads/2013/video/brian-battaglia_home-poster.jpg” width=”1000″ height=”480″ autoplay loop>
<source src=”/wp-content/uploads/2013/video/brian-battaglia_home-MP4.mp4″ type=”video/mp4″>
<source src=”/wp-content/uploads/2013/video/brian-battaglia_home-OGV.ogv” type=”video/ogg”>
<object type=”application/x-shockwave-flash” data=”/wp-content/uploads/2013/video/brian-battaglia_home-player.swf” width=”1000″ height=”480″>
<param name=”autoplay” value=”true”>
<param name=”allowfullscreen” value=”false”>
<param name=”allowscriptaccess” value=”always”>
<param name=”flashvars” value=”/wp-content/uploads/2013/video/brian-battaglia_home-FLV.flv”>
<!–[if IE]><!–><param name=”movie” value=”m/player.swf”><!–<![endif]–>
<img src=”/wp-content/uploads/2013/video/brian-battaglia_home-poster.jpg” width=”1000″ height=”480″ alt=”Video”>
</object>
</video>’;} ?>
Am I missing something? Is this completely wrong? Do I need a player? Can you recommend one? Huge thanks!
April 24, 2013 at 5:41 PM #684Leave the code active and provide the link to your website please and we’ll have a look.
April 24, 2013 at 5:44 PM #685I also added the attributes autoplay=”autoplay” and loop=”loop” to the aforementioned header.php but it did not help.
Thanks.
April 24, 2013 at 6:52 PM #686Try this method instead:
<?php if (is_home()) { ?>
WHATEVER YOU WANT HERE
<?php } ?>Quick tip, before trying it with the video code, just try plain text “abc” or “123” for example just to make sure that it appears.
If it does, but then the video code doesn’t work you’ll have pinpointed that something is wrong with the video embed code. It is also recommend to use the full URL paths instead of relative ones as you’re using when it comes to WordPress.
If you’re still having issues with your video code, a great error checking tool for HTML can be found here:
April 24, 2013 at 7:19 PM #687Thanks again, but that did not work. I put the exact syntax in with the word TEST. It does not display.
I am wondering if it needs a container between the nav and page/post? The slider has a div id and closes. What do you think? If so would we add that to the child css?
April 24, 2013 at 7:23 PM #688also looking at this player plugin. http://wordpress.org/extend/plugins/videojs-html5-video-player-for-wordpress/installation/ but again how would we get it placed where the slider normally would go. I would still like the left content/right sidebar page below the video.
April 25, 2013 at 10:10 AM #697Just tested and it works fine. Not a container issue, it will reside safely and symmetrically in the #wrapper div.
Possibly an issue with the implementation of the child theme?
April 25, 2013 at 10:32 AM #700Do you mean the sample text displayed on your test? Also, did you test within a child theme or in a native theme environment? I will look at in a bit an report back. Thanks.
April 25, 2013 at 3:43 PM #702Let’s do this, share exactly what you have in your child theme stylesheet in a reply. It may be easier to use http://pastebin.com/.
Otherwise, we’ll be here if you need more help after working on it some more.
April 25, 2013 at 6:10 PM #703April 25, 2013 at 6:42 PM #704All looks good. May we email you directly to get the login details and have a look at your live setup?
April 25, 2013 at 7:26 PM #705Yes, please. I am just about to give up, as I was also having trouble adding the mediatype for ogv in my htaccess. video shouldn’t be this hard :) I know it’s coming natively in WPv3.6. Thanks.
April 25, 2013 at 9:46 PM #706Email sent.
April 27, 2013 at 10:44 AM #716Okay, we’ve found the issue. Apparently this may be a WordPress bug where sometimes
is_home
just will not recognize the homepage correctly, likely after adjusting Settings > Reading.A workaround is:
<?php if (is_page('home')) { ?> WHATEVER YOU WANT HERE <?php } ?>
Make sure to update your original child theme and update via FTP.
April 27, 2013 at 10:55 AM #717I have to reinstall the child theme? or do you mean update the header.php both in the theme and then ALSO reupload the updated header.php thru ftp? Please be clear. ^^That is a bit terse.
Also now my body background is nerfed. It will not load a background image or color? Please advise.
Thanks.
April 27, 2013 at 12:08 PM #718None of this makes any sense, very bizarre. What we recommend doing is contacting your host and request that they do a restoration of your account to the most recent backup date they have for you.
May 2, 2013 at 8:20 PM #735Thank you so much! You are very patient, and I really appreciate it. I got it working now, after a clean reinstall of both themes!
May 3, 2013 at 10:49 AM #737Good to hear. :)
- AuthorPosts
You must be logged in to reply to this topic.