Limiting Revisions

October 17, 2014 (8 years ago)
WordPress, Database

To keep your database from bloating with endless revisions, you can limit the number that’s stored for each post.

Put this in your config.php file. (The second parameter is the number of revisions to keep.)


Load Child and Parent Style CSS

October 15, 2014 (8 years ago)
WordPress, CSS

If you are creating a child theme, you have two choices that load faster than using @import in your child style.css file.

1. You can add the parent style link to the child header.php, just above your normal css link.


2. You can add this to your functions.php file.



Social Share Buttons Without a Plugin

July 1, 2014 (8 years ago)
WordPress, PHP

Most sharing plugins are too loaded with options, and tend to slow down my sites.

I wrote this simple script to counter that.

Create this file and name it “sharebuttons.php”. Upload it to your theme directory.

You will also need to create your images, and style the div as you like.

 Then, to add the div to pages or posts, just put this in your template file, immediately following (or just before) the_content() — or wherever you want the buttons to appear:

Custom Admin Page

July 1, 2014 (8 years ago)
WordPress, PHP, Functions

I use these for those occasions when I need to store specialized information in non-WordPress tables. (Such as orders in a custom shopping cart I built.)

It’s also handy for adding informational or instructional pages to the Dashboard.

This adds the page to the WP admin menu (put in your functions.php file):

 The page itself ( lt_orders.php ) resides in the theme folder, and is a simple PHP page, with any functionality you like. It doesn’t need any header or footer calls because it is rendered inside the admin.

Custom Logo on Login Page

July 1, 2014 (8 years ago)
WordPress, Functions

It’s a nice touch to customize for the client. We can also change the link to the site home page, and the title to the site name.

Put this in your functions.php file.

Check the path and name for your image, and make sure it’s no larger than 80px x 80px.

Mobile Nav without Javascript

June 26, 2014 (8 years ago)
WordPress, CSS, Responsive Design

I wasn’t happy with the JS (or jQuery) mobile menu solutions I had been using. They always seemed to have some sort of a glitch.

My solution was to build a mobile nav which gets the menu items  with wp_get_nav_menu_items() and then display them as a select drop-down. A little bit of CSS styling on the select box, and voila! A nav menu that works perfectly every time!

Here’s the navigation code:

 And here’s the CSS:



Front End Login Form

June 20, 2014 (8 years ago)
WordPress, PHP, Functions

So many times clients (and their members) want to login on the front end. Simple to add this in the header, or sidebar. Style as you wish.

Put this in your header template (or anywhere else you want the form to appear.)


Add a Custom Avatar

June 20, 2014 (8 years ago)
WordPress, Functions

So the client has a membership site, and wants to have a custom default avatar branded to their site, to replace the boring Mystery Man, or other strange concoctions:

Put this code in your functions.php file.

 Then create your image and upload the file to wp-content/themes/yourtheme/images/avatar.jpg (you can name it anything you want).

Remove Admin Items for Users

June 20, 2014 (8 years ago)
WordPress, Functions

This function allows you to hide critical admin pages from non-admin users. They will still be able to access the pages if they know the URL, but they will not appear in the admin menu.


Add link to More Tag

June 20, 2014 (8 years ago)
WordPress, Functions

Make that pesky […] at the end of excerpts an active link.

Put in functions.php


« Previous - Next »

Skip to toolbar