• 0

youtube embed not working when last entry in post


Question

Posted (edited) · Report post

Hi

 

if I embed a youtube video with normal url in DMS so that wordpress can pick it up as oembed it does not show up when it is the last line of test in the post. If I enter some words below the youtube link the video will show up.

Edited by hansonexperience

Share this post


Link to post
Share on other sites

39 answers to this question

  • 0

Posted · Report post

Danny were do I enter those lines in Nicks function.php?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

You don't add both you only need to add the following to the functions.php file.

 

if ( ! isset( $content_width ) ) $content_width = 600;

 

Add the snippet at the bottom of the file.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Danny thx/ Clear.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Great!

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Danny very strange I even cannot reach that site.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Ah working now

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Danny your trick: if ( ! isset( $content_width ) ) $content_width = 600; works but the height is also scaled with the width in such a way that it is not nice. How could I also force the height with such code?

Is there also a responsive code to use?

 

And is this code just for youtube or does it also have effect on other images or so?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

The code is Wordpress code, I recommend you ask this question on Wordpress support forums. As I am not aware of any code that is similar, but specific to height.

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Danny yes but DMS does not the right thing. It enters somewhere a 600px in stead of doing it responsive. So it is also a DMS thing.

 

Where did find that code?

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

As far as I am aware this is not a DMS issue, I mentioned in the answer that resolved the topic that you have two options, use the embed code along with width and height attributes or use this code

if ( ! isset( $content_width ) ) $content_width = 600;

I got that code from this article - http://www.wpbeginner.com/wp-themes/how-to-set-oembed-max-width-in-wordpress-3-5-with-content_width/

 

You can also use our responsive video shortcode (near bottom of page) - http://docs.pagelines.com/tutorials/shortcodes

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

Danny the code you mentioned works but the height is not right for 16:9

I do not want the shortcode because then I have to change hundreds of postings on my blog :-)

 

Could I use a similar code as if ( ! isset( $content_width ) ) $content_width = 600; 

for the height? Such as if ( ! isset( $content_height ) ) $content_height = 500;

Share this post


Link to post
Share on other sites
  • 0

Posted · Report post

From what I have just read regarding that code the height is auto-determined to match the 16:9 ratio.

If this isn't the case you will need to contact Wordpress support.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now