Genesis WordPress: Custom Post Layout By Category

0 Flares 0 Flares ×

I hate distractions.

Especially when I am reading. If your blog is cluttered and the type is small and there are things flashing at me from your sidebar I will probably just leave.

I know sidebars are necessary functionally and sometimes they are even downright awesome with cool stuff. But if you have too many distractions people won’t read what you have wrote. Which is fine if you are writing a skimmable list style article. But in creative writing, where ever word is essential, this is unacceptable.

When I started this blog I wanted to make sure that my writing (my creative writing in particular) had a nice clean place to live. It was a long a wild journey to get it done, but I have succeeded. Now I want to share my results with you.

First

I tried a custom post type so that I could make the posts look different. But I wanted all of my posts to be in the same loop. Plus the custom post type forced me to add another layer to my url. Instead of /awesome-story-title I would have had to deal with /writing/awesome-story-title. Unacceptable.

I embarked on a 2 day quest scouring the internet, wordpress.org support forums, and the studiopress forum for an answer. After a few rage induced keyboard smashing sessions, I finally got some help and came up with a solution.

The Code

Keep in this is Genesis specific code. It won’t work unless you are running the genesis framework.

The answer, like most things came down to a simple conditional statement in my child theme single.php.

/** Add the custom writing template */

if( is_singular() && in_category('writing')) {

...Some Code...

}

That is what allowed me to remove the navigation and footer and sidebar so that you can read all of my exquisitely crafted run-on sentences with out getting side tracked.

All you need to do is replace the ‘writing’ with the name of your own category, add your code, and you are good to go.

I hope that helps. Seriously took me so many hours to get this simple code. Anyway….

Speak Your Mind

*

CommentLuv badge

0 Flares Twitter 0 Facebook 0 Buffer 0 Buffer Google+ 0 LinkedIn 0 0 Flares ×