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!

How I Got Into Coding

16 Jan

A lot of people have asked me about how I got into coding and I don’t think I’ve ever told the story before on this little blog of mine.

Growing up I was really into skateboarding and to be honest I never really even looked at a computer. That’s when I met Chris Panagapko. Chris was the one to get me stoked on computers and learning all kinds of really cool shit!

Chris and I used to play a lot of Counter-Strike together and we decided to try and get a server up and off the ground. Chris at that time already knew quite a bit about VMware Workstation and so we set up aย Windows server and installed the Counter-Strike dedicated server software on it. Chris was one of those lucky few who had a static IP at home, so we were able to run the server out of his parents basement.

We spent a lot of time in that basement messing with servers and virtualization. It was a lot of fun for a couple of nerdy kids growing up. Eventually we started a Counter-Strike clan aptly named cNc (ChrisNet Clan) which was appropriate at that time but now just makes me laugh! It was a lot of fun and again I learned some awesome shit because of it.

We wanted a web site for the clan so Chris introduced me to Microsoft Frontpage to get the job done. I remember spending hours and hours messing around with code and looking at the live preview pane hoping what I had done would work. I started to learn the basics of HTML and CSS and once I had mastered that, I really wanted to learn how to process data through a web site.

Enter PHP

I had toyed around with a lot of different premade PHP systems like E107, PHPBB, and eventually WordPress, but I wanted to write custom software. Stuff for a purpose that I could define and then write code for.

I found PHP to be one of the easiest languages to pick up because the syntax is super simple and it is very fault tolerant. It just worked for me.

Eventually I made it up in my head that this is what I wanted to do with my life. Create applications for people to use on the web. I invested a lot of time away from friends and parties to learn how to do this sort of stuff, then I went to college to learn all the fundamentals that you don’t really get when you learn on your own (or maybe some people do?).

In the end I owe my entire beginnings and career to Chris. He was someone who loved this stuff and simply shared a small chunk of his passion with me. That’s how I got into coding.

WordPress “Designers”

17 Sep

wordpress-logo-simplified-rgbThere’s something I’ve really been getting sick of lately and that is WordPress “Designers” who say that something can’t be done when in fact it can be done and is quite simple.

Quite a few of these so called designers are simply people who take an existing wordpress theme, and use the Customizer to make it look the way their client wants. They do not actually go through the motions of designing a WordPress theme.

I had a client ask me about making the thumbnails on her archives page square and not distorting the images by resizing them to 180 x 180. This is fairly simple to do however their “designer” told them it was not possible. So for that “designer”, I’ve provided a code sample as to how I did it.

This creates a div using the post image as the background image and makes the div 180 x 180. Using the background-size cover means the image will be draped over the div and not constrained to it. The result is exactly what the client asked for and took about 10 minutes to perfect.

So if you’re a “designer” you may want to learn how HTML and CSS work so that you can actually help your customers and not just take their money.