elegant themes

Category: Code Snippets

How to list WordPress Users (Editors and Authors) by role and then alphabetical by last name

| January 9, 2013 | 0 Comments
For one of our clients, we needed to list all the users on the site, first by role, and then within that role, alphabetized by last name. Each user needed to display the author's name (First Name, Last Name), the author's photo (using the User Photo plugin), and some author meta information, as follows: Editors:... View Post

How to fix apostrophes turning into slashes in WordPress

| April 15, 2012 | 9 Comments

We build our sites with a custom theme options panel in the Dashboard so that clients can manage as much of their site on their own as possible. All seemed fine and dandy until the client threw in an apostrophe! The chutzpah. Can't you just use "We will" instead of "We'll"?

The problem was that

... View Post

How to list subpages with a title and excerpt in WordPress

| April 12, 2012 | 0 Comments

We developed a site that has really rich subpages (child pages) but the parent page is mostly a blank placeholder that directs people to the subpages. Instead of merely leaving a blank parent page, we wanted to give a preview of the content on each of the subpages. I found the code for how

... View Post

Disclaimer popups before sending an email or submitting a comment using simple jQuery in WordPress

| March 28, 2012 | 3 Comments

Several of our clients requested that we add popup disclaimers before someone sends an email to the site admin or before they submit a comment. Here's a screenshot of what we're going to do:

Case 1: Add a Contact Us link to the navigation menu that triggers a ... View Post

How to link author image to their previous posts in WordPress

| May 31, 2011 | 3 Comments

It seemed so simple and straightforward to link an author's image to their page of previous posts like http://wpgarage.com/author/Rebecca/. But for some reason I couldn't find the solution easily with the default WordPress template tags. Template tags that I had used last time I needed this functionality were deprecated.

... View Post

Allow Editor access level to add users in WordPress

| May 29, 2011 | 2 Comments
Recently, a client asked us to allow editors to add users on their WordPress site. They wanted this feature so that the site managers wouldn't be tempted to click on any of the settings, and possibly mess something up. I know this is super specific but it did come up for us so maybe ... View Post

The ultimate guide to embedding HTML and iframes in WordPress – part 2

| April 7, 2011 | 3 Comments
Recently, I wrote about how WordPress users can easily add media like YouTube videos to posts and pages by just inserting the URL of the page the media is on. But that functionality was limited to sites that are oEmbed providers. ... View Post

How to remove the link to parent pages when using wp_list_pages in WordPress navigation

| July 8, 2010 | 22 Comments
Recently I was working on a client's WordPress website and he made an interesting request, that I am actually surprised we don't see more often. He wanted the top links on his navigation bar to not be live links, and only the sub-pages should actually link to pages on his site. In this case the ... View Post

Automatic Plugin Upgrade broken after WordPress 2.9.2 and some fixes

| April 28, 2010 | 2 Comments
After manually upgrading one of our client's sites to WordPress 2.9.2. we noticed that the only thing that went awry was the automatic plugin upgrade. WP asked me for the FTP information, and then gave me this error message: Cannot find Content directory (WP-Content) The first solution I found suggested to make sure that all the necessary ... View Post

How to create an archive based on custom fields, not publish date in WordPress

| April 12, 2010 | 2 Comments
We recently launched a site called theforgottenletters.org, an incredible project dedicated to translating the Holocaust-era letters of Ralph Schwab from German to English. While building the site, we needed to archive the letters based on the dates the letters were written, not when we publish them to the site. First, I tried this ... View Post
Page 1 of 41234