All Articles by Sangkrit
Register/transfer domain names at http://system.sangkrit.net and mail to system@sangkrit.net to get your web/app made/managed as per the budget allocated.
4627 ArticlesIf Skype is already installed then update is there for you in Update Manager. If you don’t have Skype then enabled Canonical Partners channel.
After updating open Software Center and search for and install ‘Skype’ package.
Vimwiki is a personal wiki for Vim — a number of linked text files that have their own syntax highlighting. – http://code.google.com/p/vimwiki/
Cracking Passwords on an Intel Celeron CPU – http://16s.us/16crack/defcon_2012/
Technorati Top 100 Blogs http://technorati.com/blogs/top100/
Add this code in your theme’s header.php file’s head section:
<link href=”https://plus.google.com/PageID” rel=”publisher” /><script type=”text/javascript”>
(function()
{var po = document.createElement(“script”);
po.type = “text/javascript”; po.async = true;po.src = “https://apis.google.com/js/plusone.js”;
var s = document.getElementsByTagName(“script”)[0];
s.parentNode.insertBefore(po, s);
})();</script>
Replace PageID (in bold text of above code block) with your Google+ Page ID.
Now visit your blog’s wp-admin (Dashboard) >> Appearance >>Widgets and drag text widget to your sidebar.
Paste following code inside your text widget (replacing PageID) :
<g:plus href=”https://plus.google.com/PageID” size=”badge”></g:plus>
For smaller badge use:
<g:plus href=”https://plus.google.com/PageID” size=”smallbadge”></g:plus>
Note: You can get your Google Plus Page ID by visiting your page’s profile and copying the number before /posts or /about in URL.
Open your theme’s function.php file and add the given function editing the thumbnail image URL (given in bold text) with your own image URL.
add_action( ‘save_post’, ‘wptuts_save_thumbnail’ );
function wptuts_save_thumbnail( $post_id ) {
$post_thumbnail = get_post_meta( $post_id, $key = ‘_thumbnail_id’, $single = true );
if ( !wp_is_post_revision( $post_id ) ) {
if ( empty( $post_thumbnail ) ) {
update_post_meta( $post_id, $meta_key = ‘_thumbnail_id’, $meta_value = ‘https://sangkrit.net/thumbnail.jpg’ );
}
}
}
You can edit WordPress post label to something Else. For example if you want to edit Posts (label) to Article so that anytime you or any other member visit you wp-admin (dashboard) he can see Article as a label on sidebar menu not posts (which is by default).
For doing this, open your theme’s function.php file and add the following code:
add_filter(‘gettext’, ‘change_post_to_article’);
add_filter(‘ngettext’, ‘change_post_to_article’);
function change_post_to_article($translated) {
$translated = str_ireplace(‘Post’, ‘Article’, $translated);
return $translated;
}
How to define an empty array ?
$my_array_1 = array();
How to define an auto incremented array?
$my_array_2 = array(“one_1″,”two_2″,”three_3”);
How to define a multidimensional array ?
$multi_dim_array = array();
$multi_dim_array[] = array(“one_1″,”two_2”);
$multi_dim_array[] = array(“three_3″,”four_4”);
echo $multi_dim_array[0][1];
echo $multi_dim_array[1][0];
How to define an array with assigned index stings ?
$my_array_4 = array(
“name”=>”your_name”,
“age”=>20,
“gender” =>”male”
);
How to define an array having assigned index numbers?
$my_array_3 = array
1=>”one_1″,
2=>”two_2″,
3=>”three_3″
);
Suppose you need to create a new custom post type, may be NEWS. So that you can allow you subscribers to post NEWS on your website. In the given example we will be creating a custom user role for NEWS and the users allotted this role would only be managing only NEWS section from WP-Admin (Dashboard).
Open your theme’s function.php file: site root >> wp-content >>themes >> function.php and add the given code block:
add_role( ‘news_user’, ‘News User’, array( ‘news’ ) );
This function generates new custom user role which can only manage
news section from Dashboard.
Although you may add some more function for new custom user role.
New custom user role can also be removed from WordPress by using the following function in your theme’s function.php file:
remove_role( ‘news_user’ );
From WordPress Function $wp_roles also you can add and remove custom user roles as show below:
global $wp_roles;
$wp_roles->add_cap( ‘news_user’, ‘manage_category’ );
$wp_roles->remove_cap( ‘news_user’, ‘view_post’ );
if ( !function_exists(‘custom_gravatars’) ) {
function custom_gravatars( $avatar_defaults ) {
$myavatar = get_template_directory_uri() . ‘/images/custom-avatar.png’;
$avatar_defaults[$myavatar] = ‘people’;
return $avatar_defaults;
}
add_filter( ‘avatar_defaults’, ‘custom_gravatars’ );
}
From this widget you can feature pages on your sidebar using an excerpt of the page and a text or image link to the page. Click here to know more features.

Download WordPress Featured Page Widget
Installation:
It is a customizable multiwidget, that displays a single post in the widget area. You can decide, whether or not the post thumbnail is displayed, whether the post title is above or beneath the thumbnail and a couple of more things. You can style the widget individually.
Download WordPress Featured Post Widget
Installation:
Facebook tells users to rat on friends: http://owni.eu/2012/07/24/facebook-added-informant/
You can easily embed SWF file inside your WordPress post either by using a plugin or by using WP hack.
Using WordPress Plugin:
Use the following shortcode for embedding your SWF file in your posts:
[swf src=”http://www.example.com/file.swf” width=200 height=50]
Note: In the given shortcode replace the link address to your own SWF file address and adjust the height and width as per your needs.
Using WordPress Hack:
Here is your WP Hack. Use following code for embedding Flash directly into WordPress pages and posts etc:
<object id=”flashcontent”
classid=”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000″
width=”550px”
height=”400px”>
<param name=”movie” value=”movie.swf” />
<!–[if !IE]>–>
<object type=”application/x-shockwave-flash”
data=”movie.swf”
width=”550px”
height=”400px”>
<!–<![endif]–>
<p>
Text written here will only be visible if the SWF fails to load.
</p>
<!–[if !IE]>–>
</object>
<!–<![endif]–>
</object>
You can embed SoundCloud in your WordPress posts using WordPress feature oEmbed. It supports auto embedding until your URL breaks the line. WP oEmbed library supports Twitter, YouTube and many other popular services. SoundCloud is not yet supported by WordPress but still you have it by using oEmbed with the help of this function: wp_oembed_add_provider()
Adding oEmbed for SoundCloud in WordPress:
Open your theme’s function.php file and add the following code:
function add_oembed_soundcloud(){
wp_oembed_add_provider( ‘http://soundcloud.com/*’, ‘http://soundcloud.com/oembed’ );
}
add_action(‘init’,’add_oembed_soundcloud’);
All done. Now you can simply paste SoundCloud URL on separate line and let oEmbed do auto-embedding.
Using WordPress Plugin:
You may also use this WordPress Plugin SoundCloud is Gold.
If you are running your blog on WordPress.Com then you may use the shortcode available for all WordPress.Com users because Sound Cloud is officially supported by WordPress.Com.
If you have a self hosted blog then you may use JetPack plugin and enable option for shortcode embeds. After doing this you can easily use the shortcode as shown here:
Google started displaying calculator on mathematical queries. Now if you visit google.com and type any mathematical problem like 9+9 etc. It automatically displays a working calculator that you can use for solving other mathematical problems.
This hack is useful for those who like to display certain category to chosen or registered users only. Add the following given code inside The Loop and choose the category (number) which you wish to remove from the display.
<?php
if ( have_posts() ) : query_posts($query_string .’&cat=-1,-2′); while ( have_posts() ) : the_post();
?>
WordPress Visual Editor don’t provides you the option to create table inside your post content. Hence to create a table in WordPress you need to know HTML. Reading this tutorial you can create tables in your WordPress posts even if your are not good in HTML.
Here you will get various table options and previews. Now to start up with your first table use the following given format in your WP post:
[table] Domain,Company,Rank
Google.com,Google,1,
Facebook.com,Facebook Inc,2
[/table]
This is an example. You can create as many formats you want and each format should be enclosed in [table] and [/table] shortcode. Given format creates three columns: Domain, Company and Rank with three rows:
|
Domain |
Company |
Rank |
|
Google.com |
|
1 |
|
Facebook.com |
Facebook Inc. |
1 |
If you post large number of images in your blog and resize each image to similar frame after you upload it. Then you may add an automatic task that will resize you images automatically:
<img src=”/scripts/timthumb.php?src=/images/whatever.jpg&h=150&w=150&zc=1″ alt=”” />
Add the following code block in your themes’s function.php file and replace the image name and address (in bold text) with your own image.
function my_custom_login_logo() {
echo ‘<style type=”text/css”>
h1 a { background- image:url(‘.get_bloginfo(‘template_directory’).’/images/custom-login-logo.gif) !important; }
</style>’;
}
add_action(‘login_head’, ‘my_custom_login_logo’);
Increase Twitter followers in just two easy steps – http://xbloggertips.blogspot.in/2012/07/increase-twitter-follower.html