Custom Post Types and the 404 Conundrum

Have you ever built out some custom post types(CPT), and when trying to get to the single post for the CPT you run into the dreaded 404 error?

Yea, me too. And it’s not fun.

Luckily the fix is usually pretty super simple. This is of course assuming that all of your loops and queries are properly set up and it’s not a coding issue. Before doing anything else, your first stop should be your error logs to see if it is indeed a coding problem.

First, you can’t have your page template named the same as your CPT. So if you created a Books CTP (remember, no caps when registering!!), if you created a special page template if can be named anything but page-books.php. That gives WordPress and headache. And when WordPress gets headaches, you’re in for some migraines.

If this is the case, rename it to something else (just remember to reset the Template on your Page since it will be reset to Default).

Even if you don’t have to do the first step (but especially if you had to do the first step) go into your Permalinks and reset them. This will remap everything.

Usually, these two steps will do the trick! Nicely done.

If not, you may have a hierarchy problem and your templating isn’t being called the way you think it is. A neat little visual to help you figure this out can be found at


WordCamp Pittsburgh 2016 – RESS Presentation Slides

I had an absolute ball at the inaugural WordCamp Pittsburgh this weekend. Between the great local WordPress community to Techshop, where we had out speakers dinner… It reminds me why Pittsburgh is one of my favorite places to visit.

I gave an updated version of my presentation on RESS (Responsive Design with Server Side components.) As promised, here are the slides from that presentation.

If, as you are reviewing these, you have any questions or have anything to add, please let me know in the comments below. Thanks!

Adding jQuery Events to Dynamically Created Elements

Recently I was working on an goal planning application that required elements that could be dynamically added that also contained elements that could be dynamically added. I.E. each Goal had multiple obstacles and each obstacle could have multiple solutions, etc.

Using jQuery, had a little plus icon that when clicked, created the first new element. I’m sure everyone has seen this in some application before. So our Goal can now have multiple Obstacles. So we added the same little plus icon to the Obstacle to create multiple Solutions. Then when clicked … nothing.

WTF, mate? Continue reading

5 Things You Should Always Check in Your Google Analytics

Google Analytics.

It is a website owners best friend, but many don’t use it. Or worse yet, don’t know how to use it.

But just in case you don’t know….

What is Google Analytics?

Other than that thing that your web designer set up and was never seen again? (j/k) It’s a service that’s provided by Google that provides analytics on the traffic coming to your website. It requires that a little snippet of code be added to your site to work, but once it is it tracks all kinds of really cool and useful data.

Why is Google Analytics important? Continue reading

RESS with Server Side Caching

During my presentation last weekend at WordCamp Scranton, someone asked how using device detection would work if they were using server side caching. There was a bit of back and forth, and basically the situation that this person was facing was this: they had server side caching enabled on their server and they had some very dynamic pages, with content coming in from multiple sources. They ended up having issues with some of the content that is dynamic being cached on the server and not showing new content when it was available. Continue reading

Responsive Design with Server Side Components Presentation

I was asked to give a presentation on Responsive Design with Server Side Components (RESS) at WordCamp Scranton, which took place this past Saturday. It was an amazing success and I had a blast being a part of it and I got to connect with a lot of great people.

There will be a video of the presentation posted in the near future, but in the interim I would like to share the slides for my presentation.

What do you think of the slides? If anyone thinks that I missed anything, let me know in the comments below or drop me a line.

Create Evenly Spaced Elements Using Only CSS

We’ve all been there. We have a series of elements that we want to line up across the parent element but, because responsive design is now king, they need to be fluid. I’ve seen some weird things with absolute positioning, and floats, and all kinds of crazy stuff.

But the truth is that there is an easier way: TEXT-ALIGN!

How It Works

Summary: we are going to create some inline-block elements and use text-align to force them to spread evenly across the parent element. In our first example, we will use “justify” while the last example will use “center”.

Continue reading

WordPress Memory Issue

If you have worked with WordPress for any considerable time, you have probably run into to dreaded Fatal error: Allowed memory size… error message. And if you haven’t, you will.

This error message is caused by your WordPress site using more memory that the server allows to be allocated to PHP. So if your server is configured to only allocate 8MG(as can be typical) and your site needs more that 8MB or memory resources, you’ll see this puppy.

There are several ways to fix this issue. One is to change the php.ini file to increase memory size. The problem with this is that some hosts don’t allow this, so you may need to contact them about increasing the PHP memory for you.

Another way is to change the wp-config.php file. This is the file that is created during your WordPress install.

While this is perfectly acceptable to do, I like to keep all of my changes within the theme that I am working with. Call if obsessive data management, if you’d like.

So whenever I need to bump up my site’s memory, I add to following code to the functions.php file in my active theme:

ini_set('memory_limit', '12M');

That’s it. Keep in mind that should you change themes this bit of code will no longer be applicable. That being said it is very rare that I do a redesign, change themes to the new theme, and continue to have a memory issue. But it can happen.

Pixels or EM’s: the Best Approach to Responsive Web Design

So it seems like everyone is onboard with the fact that responsive web design isn’t a fad or a trend but the new standard of how a website should be built. Which is good, given the amount of various devices that users are using to access the web.

So in your stylessheets, you’re all now adding something like this:

@media screen and (min-width: 1026px){
//blah blah blah

Responsive Web Design Achieved!

Well, not really.

Continue reading