WordPress Training: Vanishing Content

25 Feb

This is an issue I helped a fellow blogger out recently with content that she was trying to embed in a post in her blog, but for some reason it was not appearing in her post.

I had her send me the embed code and took a look at the code. Here’s a sample:

The code above poses a few issues for WordPress as there are a few things we have to take into account.

Your WordPress theme will have a layout for posts defined and the above code adds in a couple of divisions which are identified by the <div> tags. The div tags really aren’t necessary to display the video inside the post, and as such, we will remove them.

Once we remove them, you are left with the embed code below:

Now the code above has some issues with it as well, as your WordPress theme should be the one determining where the video sits in your post and what size it is. So in the code where you see style= is modifying the display of the video within the post.

What we need to do next is remove everything from the style except for the height and width.

 

The code above is now what we’re left with. 100% width means that the content will fill the available width of the post. Height can’t be 100% as it just doesn’t work 90% of the time. So for height I just picked an arbitrary width of 500 pixels wide but really this can be almost any number.

The product of the code above is below:

and there you have it! A working video!

Post a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.