wordpress snippets last updated   : April 22, 2014
we now have 631 snippets

List All Available wordpress Roles

wordpress snippet

Here is a snippet showing how to list all available roles. I recently used this snippet to add a role selector in the registration page. You could also use it for user searches, or post filters.

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

List all the ‘Authors’, with WP_User_Query

tutorials
display-author-avatar-within-posts-or-pages

Introduced in WordPress 3.1, the WP_User_Query class allows you to query the wp_users, and wp_usermeta tables. This allows you to create lists of authors that match a certain criteria (in this example, the role of author), and display information about each user.

The following code lists all the ‘Authors’, showing for each author its Gravatar, name with a link to an archive of their posts, and their bio.

read more

Add a Class to ‘the_post_thumbnail’ a Featured Image

wordpress snippet

When adding a featured image to a template, you may want to add a class to the image tag that is being generated. This extra class will allow you to use CSS to format it better.

read more

Redirect a successful registration to specific page

wordpress snippet

When you allow user registration on our wordpress site you may want to add something extra. Interested in thanking people after they register or just send them to a specific page for newly registered members.

read more

Remove wordpress login shake effect when error occurs

wordpress snippet

Have you ever been annoyed by the login error shake? As if the shaking is mocking you every time you enter the incorrect username or password. Ya me neither but if you do wish to remove the shake after a login error add the following snippet to the functions.php of your wordpress theme.

read more
jqsnipp.com | we just launched jquery snippets website