Get First Image of Content

Steps I follow …..

a) Audit the whole script. -> Concentrate
b) Divide the script into sections. -> Observe
c) Find the bug in the code. -> Imagine
d) Fix the bug or rewrite. -> Launch


// get first image of content

function get_first_image_of_content($content) {


$first_img '';

  $output preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i'$content$matches);

$first_img $matches[1][0];

  // default image if first image is blank



$first_img "default.png";






$html '........<img src="svnlabs.png" /> .......................';


echo get_first_image_of_content($html);


Kool Tap Accessories - KoolTap

Open Source WordPress e-Commerce Plugins

WP e-Commerce has the best Payment Gateway API out of all e-Commerce Plugins. This allows us to integrate with many of the world’s leading payment gateways. Watch this space!

WordPress Ecommerce a WordPress Shopping Cart Plugin -

WordPress Plugins wp e-commerce

eShop is an accessible shopping cart plugin for WordPress. Features include multiple merchant payment gateways; a range of shipping options; sales tax by country or state; featured/sale items and discount options. Compatible with WP Affiliate, WPMU/Multisite capable and translation-ready.

WordPress Plugins eShop

It has taken almost a year but we are proud to announce completion of our FREE WordPress eCommerce plugin featuring the legendary osCommerce online store system.

Free Ecommerce Plugin for WordPress - WP Shopping Carts - Online WordPress Store

WordPress Plugins FREE WordPress eCommerce plugin

YAK is an open source shopping cart plugin for WordPress. It associates products with weblog entries (in other words, posts), so the post ID also becomes the product code. It supports both pages and posts as products, handles different types of product through categorisation, and provides customisable purchase options — cheque or deposit, basic credit card form, basic Google Checkout integration, standard PayPal integration, PayPal Payments Pro, and and MiGS.

YAK for WordPress « a filly ate it

WordPress Plugins YAK Add-on Module – Sales Tax

Ecwid is our attempt to bring an entirely new approach to creating an online store: SaaS-based, compatible with your existing site, hassle-free and lightning-fast.

Customer’s Front-End - Ecwid- E-Commerce Widgets

WordPress Plugins Ecwid Shopping Cart

Zingiri Web Shop is a WordPress plugin that turns a great content management system into a fantastic e-commerce solution.

Cart - Zingiri Web Shop

WordPress Plugins Zingiri Web Shop

wpStoreCart is a free, open source, and full featured e-commerce platform built atop of WordPress. It is easy to use, lightweight, heavily supported and constantly updated with new features.

Wordpress eCommerce Plugin

WordPress Plugins wpStoreCart – Ecommerce Plugin for WordPress

Jigoshop is an eCommerce plugin for WordPress developed by professionals with years of experience delivering online shops for global brands.

A WordPress eCommerce Plugin that Works

WordPress Plugins Jigoshop – WordPress eCommerce

WordPress eCommerce – MarketPress – The best free ecommerce plugin available for WordPress – easy to use, beautiful & powerful.

WordPress Plugins WordPress eCommerce – MarketPress

WordPress User is Online or Offline

There are few wordpress plugin available for user online / offline status… but my requirement is different. I want a plugin that can show user status on profile page to inform other users about availability…

wordpress_users_online.php This file or function allows wordpress developer to integrate user online / offline status to their blog or site, I hope this code is quite useful when you want to develop a member site in wordpress 😉


 * Wordpress code to check wheather user is Online or not  - by S V N Labs Softwares  (
 * This is not a wordpress plugin, just a simple code to display user online status on blog or site  ;)
** User Online Status check Table   
CREATE TABLE `wordpress_users_online` (
  `user_id` int(11) default NULL,
  `full_name` varchar(64) NOT NULL default '',
  `session_id` varchar(128) NOT NULL default '',
  `ip_address` varchar(15) NOT NULL default '',
  `time_entry` varchar(14) NOT NULL default '',
  `time_last_click` varchar(14) NOT NULL default '',
  `last_page_url` varchar(255) NOT NULL default ''

** Uses

STEP 1: Add these 2 lines in header.php of wordpress theme file


STEP 2: Call function is_online() with $user_id for which we have to check online status 


  function update_user_online() {
//global $user_id;
global $current_user;

    if ($current_user->ID && $current_user->user_login) {

      $wo_user_id $current_user->ID;
$wo_full_name $user['user_nicename'];

    } else {
      $wo_user_id '';
$wo_full_name 'Guest';

    $wo_session_id session_id();
$wo_ip_address getenv('REMOTE_ADDR');
$wo_last_page_url getenv('REQUEST_URI');

    $current_time time();
$xx_mins_ago = ($current_time 300); 
// remove entries that have expired
mysql_query("delete from " TABLE_USER_ONLINE " where time_last_click < '" $xx_mins_ago "'");

    $stored_user_query mysql_query("select count(*) as count from " TABLE_USER_ONLINE " where session_id = '" mysql_escape_string($wo_session_id) . "'");
$stored_user mysql_fetch_array($stored_user_query);

    if ($stored_user['count'] > 0) {
mysql_query("update " TABLE_USER_ONLINE " set user_id = '" . (int)$wo_user_id "', full_name = '" mysql_escape_string($wo_full_name) . "', ip_address = '" mysql_escape_string($wo_ip_address) . "', time_last_click = '" mysql_escape_string($current_time) . "', last_page_url = '" mysql_escape_string($wo_last_page_url) . "' where session_id = '" mysql_escape_string($wo_session_id) . "'");
    } else {
mysql_query("insert into " TABLE_USER_ONLINE " (user_id, full_name, session_id, ip_address, time_entry, time_last_click, last_page_url) values ('" . (int)$wo_user_id "', '" mysql_escape_string($wo_full_name) . "', '" mysql_escape_string($wo_session_id) . "', '" mysql_escape_string($wo_ip_address) . "', '" mysql_escape_string($current_time) . "', '" mysql_escape_string($current_time) . "', '" mysql_escape_string($wo_last_page_url) . "')");
is_online($user_id) {  
$stored_user_query mysql_query("select user_id from  ".TABLE_USER_ONLINE."  where user_id = '" mysql_escape_string($user_id) . "'");
$stored_user mysql_fetch_array($stored_user_query);
$online '<img src="online.png" border="0" />&nbsp;Online'
$online '<img src="offline.png" border="0" />&nbsp;Offline';


Online Or Offline

Find online syntax highlighter here…

WordPress function that helped…

Auto Translation using Wibiya

Wibiya is a one-stop solution for the creation of a fun and customizable free web toolbar. Using the Wibiya free toolbar you can integrate, manage and track third party applications like facebook, twitter, youtube, blog feeds etc. easily.

Boost your Blog/Website with Rich and Interactive Features

* No coding necessary

* Add it in two minutes

* Totally free web applications!

For Auto Translation using Wibiya copy below code with wibiya javascript widget…

<script type=”text/javascript”>

// <![CDATA[

jQuery(window).bind(“load”, function()
// code here
// ]]>


Now languages no bar 😉

Make your website instantly available in other languages

I think everyone know about google language translation

We can use to translate webpage/blog content in worlds very known languages

Add the free Google Translate gadget to instantly translate your webpage or blog into other languages: English, Afrikaans, Albanian, Arabic, Armenian, Azerbaijani, Basque, Belarusian, Bulgarian, Catalan, Chinese, Croatian, Czech, Danish, Dutch, Estonian, Filipino, Finnish, French, Galician, Georgian, German, Greek, Haitian Creole, Hebrew, Hindi, Hungarian, Icelandic, Indonesian, Irish, Italian, Japanese, Korean, Latvian, Lithuanian, Macedonian, Malay, Maltese, Norwegian, Persian, Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovenian, Spanish, Swahili, Swedish, Thai, Turkish, Ukrainian, Urdu, Vietnamese, Welsh, Yiddish….

Other translation tools