Treehouse: Grow your CSS skills. Land your dream job.

WordPress Best Practices – How do you make it so your clients can use classes?

  • # September 23, 2012 at 9:45 pm

    I’m about to turn over a web site to a client. However, for the first time, I have coded a site that does require

    surrounding some of the entries that she will make.

    What’s the best way to do this? I’m thinking shortcodes, but is there a better way, by which perhaps one can put classes on the format bar? I messed around with TinyMCE Advanced but it didn’t go well.

    # September 23, 2012 at 10:06 pm

    My first thought would be to have a custom field. Based on whatever is picked and entered by the client, the post in question could have a specific class (perhaps of a wrapping div).

    There’s probably better methods but this is just one option that comes to mind.

    Oh, if you know there will only be a small amount of classes that can be used, you can of course pre-code that in the template, and have the client just pick the template upon posting.

    # September 24, 2012 at 12:02 pm

    That’s an interesting idea. It doesn’t work with the site I’m doing currently because she needs to add content to existing pages. But it actually suggests a better way of structuring a site like this.

    I did figure out how to add a drop down list of styles on the formatting bar. And that might be the best way to go in this case. But I will consider that for the future.


    # September 24, 2012 at 1:46 pm

    You should be able to provide the client with a dropdown of classnames in TinyMCE, that way your client can just select the code (or click on an element in the breadcrumb trail) and then select a class for it.

    # September 24, 2012 at 1:47 pm

    Here’s an article I found after a quick search, not sure if it’s the best but should be a good starting point.

    # October 14, 2012 at 8:47 pm

    Thanks very much for the article. (I’m sorry I didn’t see your post earlier for some reason!)

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.