Archive for September, 2008

Wp Unique Article Header Image Plugin for Wordpress

Monday, September 22nd, 2008

hi all.here I am back with another brand new plugin to enhance your blog.Ok,If you have ever thought of the following,then this plugin is for you.

  • You wanted to show unique header image on each single article page of your wordpress(or may be on some of the single article pages)
  • You wanted to have a unique background image for each of your single article page(or may be just on some of them)

If your answer is yes,Then this plugin is for you.It allows you to upload an image using the wordpress new post/edit post/page window.It adds a file uploading button just below the title of the post as shown below

New Post window
2

Now select an Image and when you click publish/save the default image is changed with the current image.

Browse Header Image to upload
2008-09-17_055340

Once you click save/publish,Go to manage->posts->your post and click to edit.you will see that the default image is changed with the new image uploaded.

Post edit window
edit-screen-gt-unique-header

How to use

For your use there is a method gt_get_image_url(), it returns unique image associated with each post.you may use it in any way you want.here is an example,how I modified the default theme on the demo server to show unique header images on each post.

Now,let us edit our themes header.php to make use of unique header on each of the page.we add following snippet of code to our header .php

Code snippet to be modified

Code snippet to be modified

[Please note this code shown here, is for the default theme Kuberick,which comes with wordpress,depending upon your theme and header you may need to use custom css here]

See the live demo here [Click on the articles on the demo site to see the use of unique header thing)

NOTE:It seems ,someone has deleted all the posts from the demo site,as i mistakenly provided the test user rights to edit/delete posts.well,I will be correcting my mistake tomorrow.For the time being,I encourage you to login and try uploading some image of your choice on the demo site and looking at it in action.

http://plugins.wpdemos.com/gt-unique-header-image/

Do you want to try it yourself,well use following credentials

http://plugins.wpdemos.com/gt-unique-header-image/wp-admin/

User: test

Password: test

Try,posting some new posts with any image of your choice and then click to view the page.
ok,so you need a download link now.Here goes the download link
http://downloads.wordpress.org/plugin/wp-unique-article-header-image.zip


get_user_by_email()

Monday, September 15th, 2008

This is second in the series of un documented but useful wordpress api functions.

get_user_by_email($email)

Description

It is one of the important but not documented method on codex(as of now),It provides same information as the get_userdata(),get_userdatabylogin(), except the fact that it takes the email address of registered user(e.g. admin@geekytalks.com as an argument rather than the ID/username of user).It returns an object with the information pertaining to the user whose login name is passed to it. Properties map directly to wp_users table in the database.

Usage

The call to get_user_by_email() returns the user’s data, where it can be retrieved using member variables.

<?php
$user_info=get_user_by_email(get_option('admin_email));
echo ('Username:'.$user_info->user_login . '\n');
      echo('User level: ' . $user_info->user_level . '\n');
      echo('User ID: ' . $user_info->ID . '\n');
?>

Username: admin
User level: 10
User ID: 1

Accessing Usermeta Data

<?php
$user_info=get_user_by_email(get_option('admin_email));
echo ($user_info->last_name .  ", " . $user_info->first_name . "\n");
?>

Singh,Brajesh

Parameters

$email

(String) (required) The email address(of registered user) of the user whose data should be retrieved.

Default: None

Values in users & user_meta table

Here are the values in the users table you can access via this function:

users

  • ID
  • user_login
  • user_pass
  • user_nicename
  • user_email
  • user_url
  • user_registered
  • user_activation_key
  • user_status
  • display_name

useful in user_meta

  • first_name
  • last_name
  • nickname
  • user_level
  • admin_color (Theme of your admin page. Default is fresh.)
  • closedpostboxes_page
  • nickname
  • primary_blog
  • rich_editing
  • source_domain
  • It works in the same manner as get_userdata() ,except that the argument passed in get_userdata() is an integer(The ID of User),while In the case of get_userdatabylogin() ,the argument passed is string(The Login name e.g. “admin”)

See as a reference :http://codex.wordpress.org/Function_Reference/get_userdata


get_userdatabylogin

Saturday, September 13th, 2008

I am going to describe here some of the methods which can come handy for a theme developer or plugin developer,but are not documented at Wordpress Codex.Today, I am beginning the series with get_userdatabylogin($login_name)

Description

It is one of the important but not documented method on codex(as of now),It provides same information as the get_userdata() except the fact that it takes the login name(e.g. “admin” as an argument rather than the ID of user).It returns an object with the information pertaining to the user whose login name is passed to it. Properties map directly to wp_users table in the database.

Usage

The call to get_userdatabylogin() returns the user’s data, where it can be retrieved using member variables.

<?php $user_info=get_userdatabylogin("admin");
echo ('Username:',$user_info->user_login . '\n');
      echo('User level: ' . $user_info->user_level . '\n');
      echo('User ID: ' . $user_info->ID . '\n');
?>

Username: admin
User level: 10
User ID: 1

Accessing Usermeta Data

<?php $user_info=get_userdatabylogin("admin");
echo ($user_info->last_name .  ", " . $user_info->first_name . "\n");
?>

Singh,Brajesh

Parameters

$login_id

(String) (required) The Login_name(Login Id) of the user whose data should be retrieved.

Default: None

Values in users & user_meta table

Here are the values in the users table you can access via this function:

users

  • ID
  • user_login
  • user_pass
  • user_nicename
  • user_email
  • user_url
  • user_registered
  • user_activation_key
  • user_status
  • display_name

useful in user_meta

  • first_name
  • last_name
  • nickname
  • user_level
  • admin_color (Theme of your admin page. Default is fresh.)
  • closedpostboxes_page
  • nickname
  • primary_blog
  • rich_editing
  • source_domain
  • It works in the same manner as get_userdata() ,except that the argument passed in get_userdata() is an integer(The ID of User),while In the case of get_userdatabylogin() ,the argument passed is string(The Login name e.g. “admin”)

See as a reference :http://codex.wordpress.org/Function_Reference/get_userdata


Google Chrome -A next Generation Browser

Tuesday, September 2nd, 2008

Google Chrome(an open source browser as they say!) was launched officially on 2nd September.It is in beta version currently.When I first heard about it,It was some twitter friend ,who wrote about it.Finally I went to http://tools.google.com/chrome/ and downloaded it.The installation was a breeze ,it took just 1 minute to download and install(I am using 1 Mbps connection).

It has inbuilt facilities for importing my firefox bookmarks,history,passwords etc.Ahh..I am waiting to see the first site of this Google browser.Thank God,It started now.Wow,what a clean interface.It is so impressively thin,I am really starting loving it from the first start up only.

have a look how it looks like

Google Chrome
startup

Good, so Google is really concerned about it.It seems the world is turning to blue again[:D],It’s fist browser,which has such a sleek look(though I am a fan of firefox,for its large number of extensions and developers support).

Some Features of Chrome

  • It is visually pleasing,something your eye will love to browse with
  • It has incognito mode(.Do you know what incognito mode is,well I am posting an image for details),In incognito mode it does not remember browsing history and cookies etc.
  • It Is based on WebKit rendering engine,the same engine being used by safari 3.X
  • It uses v8 javascript engine(also by google),one of the fastest javascript engine
  • It is made from scratch ,keeping in mind the current web architecture,so hopefully it will perform better
  • It uses the location bar for searching and url both, you can type something in the location bar and press enter to search it on google.

Here are some of the screenshot,to show some of the features of this browser

Incognito Mode

Incognito mode
2008-09-03_015903

Home page,It contains most visited,recently browsed,bookmarked sites,good..that’s really good idea,a little bit inspired from opera(speed dial)

Home Page
2008-09-03_022630

Here is how the history page looks(very nicely done!)

History Page
2008-09-03_022614

The customizations are quiet easy and pretty straight forward.first times,it seems I am working some something really cool!.

Btw,There are some disadvantages too

  1. It forks a new process for each tab,so if you have 6 tabs open you will see 7 or more chrome.exe running.
    Multiple instances of chrome.exe
    2008-09-03_023001

You see the four chrome.exe running,while I had only 3 tabs open at that time.

2.It’s more memory intensive(at least as I see on my system)

But still overall,I liked the way it’s looking and working(seems to be fast )

to download Google Chrome browser ,use the following link http://tools.google.com/chrome/