Gravatar WordPress Comments

Today I searched gravatar wordpress comments trying to figure how to get the gravatar images next to the comments in a wordpress.org theme. I was surprised to find that wordpress natively supports gravatars in 2.5 and above. To use it you just call get_avatar and pass in the email and an optional size and it spits out the image html. Once I found the loop of comments in the template code, I just added the below code in a div next to the comment text.

I used comment_author_email on the php comment object to get the email address of the person who made the comment. It was pretty painless to do and a great feature to add to my template.

jQuery Sortable Placeholder Height Issue

Today I searched jQuery Sortable Placeholder Height Issue because when I dragged my sortable list the placeholder was shrinking to have a 0 height. It was tough tell where exactly I was moving it to. I needed to get this working or it would drive me crazy. So I tried a couple things before I found a solution. I made sure that there was a height on the element and in my jQuery call I used the options placeholder: ‘ui-state-highlight’ and forcePlaceholderSize:true, none of these things worked. Then I found that you could set the height of the placeholder on the start event of your sortable like this.

$( ".selector" ).sortable({
   placeholder: 'ui-state-highlight',
   start: function(event, ui) {
        ui.placeholder.height(ui.item.height());
   }
});

Once I added this code and refreshed, it a beautiful site to see a jQuery sortable placeholder work.

PHP 301 Redirect

Today I searched PHP 301 Redirect and I found that it was very simple. All you need to do is add this code to the header of the the php page.

Then you just change “http://www.new-url.com” to the url you want the page to get redirect to. Once that is done you have successfully redirected a page using a 301 redirect.

Go back to top