wordpress snippets last updated   : October 6, 2014
we now have 641 snippets
category posts

Change wordpress admin post columns order

wordpress snippet

I have needed to move a post column like “date, tags, author” or even a custom column within the wordpress admin. This is a simple method that I used to change the order of columns within the admin. What you have is two variables you will need to change $move and $before. Move is the name of the column you would like to move. Before is the name of the column you would like to move it before. The following snippet will let you move the author column before the post title column.

read more

Track post and page views by user ID, date and time

wordpress snippet

After an interesting conversation with a fan of wpsnipp, I come up with something to track unique post views for registered users. However this neat little snippet does a little more than that. First add wps_trackViewDates(); within the loop of your single.php template file. Once this has been added, the snippet will track the ID of the user that viewed an individual post along with the date and time it was viewed.

read more

Remove width & height attributes from images in posts

wordpress snippet

Looking to remove the width and height attributes from images in your posts? Is this because you are using a responsive wordpress theme. Just add this snippet to the functions.php of your wordpress theme and all of the width and height attributes will be removed from your images.

read more

Display post attachment count in admin column

wordpress snippet

Sometimes you have a post with multiple attachments and it would be nice to see a count of the total media attached to a post. Adding this snippet to the functions.php of your wordpress theme will display the post attachment count in a custom admin column.

read more

Add wordpress post types to the dashboard ‘At a glance’ widget

wordpress snippet

The WordPress dashboard includes a handy widget that displays some brief information about your site at a glance – rather creatively, it’s titled ’At a Glance’. By default it shows you the number of posts, pages and comments on your site allowing you to click through to edit each of those sections if you have the right permissions.

read more

Navigate next, previous adjacent post with jquery and the left, right keys

wordpress snippet

If you are using adjacent post relational links in the head of your wordpress theme add this little bit of jquery. This will let people navigate next, previous adjacent post with the left and right arrow keys.

read more