06.09.2010

Yesterday, I attended WordCamp Jerusalem 2010 and lectured about WordPress 3.

My presentation included some very handy code snippets, links and information so I decided to upload it to slideshare for anyone to catch up.

The video:

I used WordPress’ get_the_post_thumbnail() function in order to output the current post’s featured image. It was great, until I had to link to the featured image. To do that, I needed the value of the SRC attribute of that IMG tag, i.e., the direct link to the featured image.

Thanks to phpxref, and the WordPress Codex, I managed to write a small useful function just for that. Without further ado, I present to you, the function:

function oy_get_direct_thumbnail_link( $post_id = NULL ) {
	global $id;
	$post_id = ( NULL === $post_id ) ? $id : $post_id;
	$src = wp_get_attachment_image_src(get_post_thumbnail_id($post_id), 'full');
	$src = $src[0];
	return $src;
}

The first and only parameter ($post_id) is optional. If used inside the loop, it fetches the current post’s ID by itself.

Search terms:
10.05.2010

If the question intrigues you, this video of me lecturing about it will probably answer it for you. This video was shot last month in a user-generated content meeting organized by StartupSeeds.

The lecture is in Hebrew but there are English subtitles available.

First, thank you for the bug reports. Without them, new & enhanced versions simply won’t come out.

The plugin now has better video detection capabilities, and a serious bug regarding the auto thumbnailing feature is fixed.

You can download the new version at:
http://wordpress.org/extend/plugins/youtube-thumbnailer/

Any bug reports, feature requests or comments are welcomed in the comments section below.

Search terms:

dot comHave a look at your browser’s address bar – your sight is just fine. You actually are on orenyomtov.com as opposed to this morning, when this website lived under the .info TLD.

It has been quite a long time since I made the decision to move to the new domain. But there were two drawbacks which delayed the domain transfer. The first one is lack of time, and the second one is… Well, my laziness.

Anyways, I thought I would share some of the steps I took in order to move the website to the new domain. I was lucky enough that I didn’t have to change hosts. Doing that may have required some additional steps.

  1. I bought the new domain and linked it to my hosting.
  2. I downloaded the latest WordPress installation and uploaded it into the new domain by FTP (Looking for an FTP client?).
  3. I copied the wp-content folder. And in my case, the “downloads” folder which is the folder I chose to store the uploads in (Default is wp-content/uploads).
  4. I also copied the wp-config.php file and the .htaccess file.
  5. I used the Search and Replace WordPress plugin to replace “orenyomtov.info” with “orenyomtov.com” in the database.
  6. I notified Google of the domain change in Google Webmaster Tools.
  7. I exported a new sitemap using the Google XML Sitemap Generator plugin and submitted it to Google Webmaster Tools.
  8. I opened a new Google Analytics account and deployed the new tracking code in the theme I copied in step 3.
  9. I edited the old .htaccess file to contain only:
    RewriteEngine on
    RewriteRule (.*) http://orenyomtov.com/$1 [R=301,L]
  10. I updated my FeedBurner account and all other similar services.
  11. I updated my website to the new URL in all of my favorite social platforms (@orenyomtov) and forums.
  12. Twit twit.
  13. And then I began writing this post.

The move didn’t take as long as I expected it to take. Even though it does seem a little complicated after writing it all down.

I hope that your move will be as smooth as mine. Good luck, Oren.

Search terms:

I’ve received many emails complaining that the plugin does not recognize YouTube videos. Because of lack of time, I delayed the update until now.

I just released an update to the plugin which should solve most of the issues that I was contacted about.

Go ahead and download the new version:
http://wordpress.org/extend/plugins/youtube-thumbnailer/

A theme consists of many files, this can get very confusing very fast. What files are needed? What files runs when and why? Here are the explanations and tips about WordPress template files.

First things first, what is a template exactly? A template is a PHP file that is a part of a theme. For example, there is a template for displaying the home page, one for displaying pages and another one for displaying posts.

What Are The Existing WordPress Tempaltes?

Here is a list of the existing WordPress templates that can be used in themes:

Here is a very useful image provided by WordPress Codex (click to enlarge):

WordPress Template Hierarchy

Custom Templates

There are two main types of custom WordPress templates.

The first one are templates that WordPress looks for automatically, and if one is found it will be used. What the heck am I talking about?
If you have a category called “News” with the ID of 512 and you want the archive page of that category to have it’s own unique template you can create a new template file called category-512.php in the theme’s folder. And WordPress will use it.

This is the list of custom wordpress templates you can use:

WordPress Custom Template Drop Down

Now for the second type of WordPress custom templates.

Let’s say you have more then one page* you want to be displayed in a different way then the others. How do you do that?
Create a new file called whatever.php at your theme’s folder and inside write whatever you want instead of single.php or index.php (depending what displays the single posts at your theme).
Add this comment to the top of the file:

<?php
/*
Template Name: The Whatever Template Yo
*/
?>

(Of course change The Whatever Template Yo to the new template’s name)

Now edit (or create) the pages which you want to use this template and in the right side pick the desired template from the drop down menu. Just like in the screenshot at the right side.

*If you want to do this for posts rather then pages then you will find the Custom Post Template plugin very useful.

Any questions/corrections? Comments are always welcome.

Search terms:

jQuery is not defined - FireBug
Do you get “jQuery is not defined” as an error after a fresh WordPress Install? JavaScript not working at your admin panel? Don’t worry, I have the solution.

After installing two new WordPress installations with defective admin JavaScript that won’t allow me to

I understood I was having some kind problem with the Javascript jQuery library.

I deactivated all the plugins and nothing happened. Then I started looking at the source code and googeling for quite a long time. After some serious research I discovered what caused the issue.

The Problem

While uploading the WordPress installation files onto the server I had some issues that cause some of the JavaScript files to not be uploaded / be corrupted.

The Solution

wp-includes/js
Re upload the wp-includes\js folder and overwrite whatever is in there.
That’s what fixed it for me.

I hope this helped someone, if it does, or does not – comment to help or get help.

Search terms:
21.08.2009

YouTube New LogoI have received a request from someone that wants even more from my WordPress Custom Fields Plugin. He has a category called “videos” which has posts with YouTube videos embedded with some plugin. He wants to put the videos thumbnail as the post’s thumbnail.

First, how is the video embedded in the post? It uses the following syntax:

Now you can embed it like you would normally do.

Second, how do we get the thumbnail itself after we extracted the video key? We build the image’s URL with the following syntax:
http://i2.ytimg.com/vi/$video_key/default.jpg

Now, how do we put all of this together into a plugin that inserts the thumbnails?
You don’t have to because I have already done it for you.

This plugin runs through the posts in your blog and if it finds a YouTube video embedded in a post it sets the thumbnail to be the video’s thumbnail.
That’s it, have fun playing with the configuration.

If you encounter any issues please comment/contact me.

Search terms:

1000 Downloads on the WordPress Plugin Directory
As you can see in the plugin‘s stats page, It currently has 1050 downloads!

Although the number may be not as big as other plugins (All in On SEO got over 2.5 million downloads), it means a lot to me. Every time you see numbers on the internet you don’t really think about them as you would outside the monitor. When viewing YouTube videos, if I see a video that has less then 5k views most of the times I won’t enter it and try to find another one with millions of views.

But when you think about the actual numbers it’s a huge amount of people sitting on their chair at home or at work, entering YouTube and watching the video. The same goes to plugin downloads, It’s really cool to know that my plugin helped over 300 (?) other people around the world that have their own website.

Update: It how has over 3000 downloads!

Search terms:

Next Page »