WordPress Tips & Tricks #1

I find collections of tips and tricks very useful when problem solving so here are some of my favourite WordPress CSS techniques.

Disable / Hide / Remove Comments

If your theme has no option to disable / hide / remove comments, a good technique using CSS only is as follows:

1) View the HTML source for a page showing the comment form and find the wrapper class for the comments section (often something like ‘entry-meta’ or similar).

2) In your theme’s style.css file, add the following code:

.entry-meta { display: none


Alternatively, if your theme has an area where you can add CSS, add it there.

To make it work, sometimes you’ll have to prefix the wrapper class tag with something else, for instance another parent CSS tag e.g.

div.entry-meta {display: none


Also, this process (find the wrapper / container tag by checking the code and apply the display: none attribute to it) can be applied to almost anything you wish to hide in a theme.

Child Themes

As soon as you find yourself having to manually edit any theme code in WordPress, I would always recommend using a child theme. They are very easy to set up, though you will usually have to re configure widgets, menus, header images, backgrounds and customisations again when you enable the child theme.

To set up a child theme:

1) In wp-content/themes, create a new folder named after your child theme

2) In that folder, upload a style.css file containing the following code, as a bare minimum…

Theme Name:     My Child Theme
Theme URI:      http://example.com/
Description:    A description
Author:         Jon Cook
Author URI:     http://joncook.me
Template:       parentheme
Version:        0.1.0

@import url("../parenttheme/style.css")

Make sure you replace ‘parenttheme’ on the Template line and in the @import line with the folder name of your parent theme.

3) Go back into the available themes screen in your WordPress Dashboard and enable your new child theme

4) Re-do any customisations you made to the parent theme

5) You can now add any custom CSS you like to the child theme’s style.css file and copy any template php files from the parent to the child theme and edit them as you wish.

Facebook Page Widget

If you’d like a Facebook page widget allowing website users to directly like the page etc, I’d recommend using Facebook’s own ‘Like Box’ app http://developers.facebook.com/docs/reference/plugins/like-box/.

This allows you to complete an online form and generate code to paste directly into a WordPress text widget. This saves you having to install a plugin to achieve the same functionality and in my experience at least, seems to work more reliably.

You may also like...