Welcome To TodayISearched.com

TodayISearched started with the idea of logging solutions that we had to search the internet for and recording their resolution. There have been many times when we have found a solution and needed it again 6 months – 1 year down the road and can’t remember for the life of us where we found it. This blog gives us the opportunity to catalog useful solutions that we can go back to. We thought it would be beneficial to share this with the rest of the world. We would like to invite you to participate in our blog. If you have a nagging problem that you cannot find a solution for (technical problem preferably) or want to share a solution you found while scouring the net, please shoot us an email todayisearched[at]gmail[dot]com. Your suggestion just might make its way onto our blog. Happy Searching!

The TodayISearched.com Team

Get JavaScript Object From jQuery

Today I searched Get JavaScript Object From jQuery trying to fix old code. I wanted to fix it by using some jQuery selectors but I still wanted to use most of the old JavaScript code. I initial passes up the jQuery page on the .get() method but then came back to it and was exactly what I needed.

Retrieve the DOM elements matched by the jQuery object.

So it was simple to get the first element of the selector with the get object.

var javascriptVar = $("#jQuerySelector").get(0);

This worked perfectly and allowed all of the old javascirpt to function with the more advanced selector than the good old document.getElementById()

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) { 

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.