WordPress.org

Ready to get started?Download WordPress

Forums

Change embedded video size in Single Post (3 posts)

  1. Flameblade
    Member
    Posted 1 year ago #

    On my blog homepage I have videos embedded to a certain width. However, on the Single Posts I have moved the sidebar to make the content space wider and would like to make the videos larger as well.

    I'm having trouble figuring this out since the embed code which governs the video's width is in the post itself and I can't put an IF clause inside the post.
    I also don't seem to be able to give the video a custom width using css code.

    Any help would be great.

  2. p5systems
    Member
    Posted 1 year ago #

    HI

    You can use one custom field to enter the video embed code so that in the single page you cna call it different size video.
    As useval post page iit will take only the size mentioned in the content of the post.

    Second option:

    Use any embed plugin so that we can use any size videos in any page with shortcode or php function.

    Thanks
    P5systems

  3. Flameblade
    Member
    Posted 1 year ago #

    You can use one custom field to enter the video embed code so that in the single page you cna call it different size video.

    I tried that. Setting the embed width to 100% fixes the video at a tiny size instead of making it fill the field, the only way to make the video a certain size is to specifically write a number, but I want it to be bigger on the Single Page.

    Use any embed plugin so that we can use any size videos in any page with shortcode or php function.

    I tried several but none of them work. Some don't even display the video at all. Any suggestions?

    ------------------------------------

    My current setup is this: In my header.php I have this code in the body

    <body<?php if ( is_single() ) {
    echo ' class="widescreen" '; } ?>>

    This sets the 'widescreen' class if it's a Single Page

    Then in style.css:

    .video-embed {
    text-align: center;
    width: 660px;
    padding: 0px 0px 40px 0px;
    position: relative;
    left: -2px;
    }

    .widescreen .video-embed {
    text-align: center;
    width: 900px;
    padding: 0px 0px 40px 0px;
    position: relative;
    left: -2px;
    }

    This sets the field for the video. It's wider if 'widescreen' is true.

    And then in the post I have this:

    <div class="video-embed"> [embed width=660px] *VIDEO URL* [/embed] </div>

    The embed size is set to 660px because setting it to 100% displays the video in a tiny size. But I want it to be 900 if 'widescreen' is true.

Topic Closed

This topic has been closed to new replies.

About this Topic