But I need something more. A bit of code to generate the same class on multiple pages of my choosing. Basically, on this site here, I’m going to have a lot of galleries. Like a hell of a bunch. And in my CSS, I’d like to be able to target all of my galleries in one swoop with a single class. Is this even possible? I need to be able to add a single class, like gallery, to the pages I specify within WordPress. Any and all help will be muchly appreciated.

When I look up how to create a child template in Google, all that comes up are “child theme” tutorials. So, currently I’m using theDefault Template within my theme on my gallery pages, so I figured if I copied the index.php and added…

<?php
/* Template Name: Gallery */
?>

…to the top and changed the template to Gallery within the page settings it would work, but it’s not. The page loads just fine, but it looks nothing like it did when I had Default Template selected.

You may want copy the single.php file content and not the index.php depending on what page you are trying to load. Then again if you are using a theme someone created then you will need to see if they are using their own custom template that your page was loading with and copy that.

Tips

What now? I have some ideas for you.

Go explore CodePen!

As a front end designer and developer, you should have an account on CodePen so you can save your snippets, present your ideas, and engage with other front end folk. I'd encourage you to go PRO as well, to unlock the full power of CodePen.

Get the newsletter!

You should sign up for the CSS-Tricks newsletter. It's a clean copy of all the blog posts each week, combined together, right to your inbox. If email isn't your thing, there is an RSS feed, iTunes, and lots of other ways to subscribe.

Listen to ShopTalk!

Subscribe to The Lodge!

The Lodge is a members-only, ad-free video learning area here on CSS-Tricks. Just like the free screencasts, but organized into four large complete series. Membership is also the #1 best way to support CSS-Tricks.

We can do the real footer now.

Site Links

Colophon

CSS-Tricks* is created, written by, and maintained by Chris Coyier. It is built on WordPress, hosted by Media Temple, and the assets are served by MaxCDN. The fonts are Source Sans and Source Code Pro. It is made possible by viewers like you who subscribe to The Lodge and through advertising for products and services I like.