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.

4518 Articles

Show Related Posts In Your WordPress Blog Without Using Any Plugin

Copy and Paste the given code within the loop. It may engage your blog visitors to stay for a longer time:

<?php
//for use in the loop, list 5 post titles related to first tag on current post
$tags = wp_get_post_tags($post->ID);
if ($tags) {
echo ‘Related Posts’;
$first_tag = $tags[0]->term_id;
$args=array(
‘tag__in’ => array($first_tag),
‘post__not_in’ => array($post->ID),
‘showposts’=>5,
‘caller_get_posts’=>1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></a></p>
<?php
endwhile;
}
}
?>

This code displays posts related to current post. It is based on tags. You may change the number of posts it displays, just change ‘showposts’=>5 with your number.

Display Popular Posts In Your WordPress Blog’s Sidebar Without Using Any Plugin

You can highlight most popular content of your WordPress site in your sidebar. Copy-Paste the following code in your theme’s sidebar.php file:

<h2>Popular Posts</h2>
<ul>
<?php $result = $wpdb->get_results(“SELECT comment_count,ID,post_title
FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 5″);
foreach ($result as $post) {
setup_postdata($post);
$postid = $post->ID;
$title = $post->post_title;
$commentcount = $post->comment_count;
if ($commentcount != 0) { ?>
<li><a href=”<?php echo get_permalink($postid); ?>” title=”<?php echo
$title ?>”>
<?php echo $title ?></a> {<?php echo $commentcount ?>}</li>
<?php } } ?>
</ul>

It displays most popular posts on your site’s sidebar.

For changing the number of posts to display in your sidebar:

Look-up for this line in the above code block: FROM $wpdb->posts ORDER BY comment_count DESC LIMIT 0 , 5″); and Replace 5 with the number of posts you like to display.

Easiest Way for Displaying both Popular and Unpopular Posts in your Sidebar:

Now easiest way to do this (display popular posts) and many other similar things like displaying both popular and unpopular posts, knowing the number of post hits is to use Most and Least Read Posts Widget Plugin

Download from the link, activate it and start using it by placing its widgets in your sidebar. It gives you two different widgets one shows most read posts and the other shows least read posts and also it counts your post hits both on sidebar and in your dashboard All Posts list.

Add “Pin It” Button To Your Google Chrome’s Bookmark Bar

For installing “Pin It” button in your Chrome:

  1. Visit Pinterest Goodies.
  2. Display your bookmark bar if it is hidden: Visit Wrench Icon (present at the top right corner of chrome) >> Bookmarks >> Check Show Bookmarks Bar
  3. There is a “Pin It” button on that page. Drag it to your bookmark bar.
  4. Now while browsing the web you can pin any image by pressing this “Pin It” button.

Watch this video tutorial:

[iframe][/iframe]

Add ‘Pin It’ Button To Images In Your WordPress Blog

Without using Plugin: Add this code to your theme’s footer.php file before the </body> tag. Get Pinterest’s javascript at Goodies.

<script type=”text/javascript” src=”//assets.pinterest.com/js/pinit.js”></script>

Add this code to your theme’s single.php file wherever you want Pin It button to be visible:

<a href=”http://pinterest.com/pin/create/button/?url=<?php the_permalink(); ?>&media=<?php echo catch_that_image() ?>&description=<?php the_title(); ?>” class=”pin-it-button” count-layout=”horizontal”><img border=”0″ src=”//assets.pinterest.com/images/PinExt.png” title=”Pin It” /></a>

Add this code in your theme’s functions.php file:

function catch_that_image() {
global $post, $posts;
$first_img = ”;
ob_start();
ob_end_clean();
$output = preg_match_all(‘/<img.+src=[‘”]([^'”]+)[‘”].*>/i’, $post->post_content, $matches);
$first_img = $matches [1] [0];
if(empty($first_img)){ //Defines a default image
$first_img = “/images/default.jpg”;
}
return $first_img;
}

Or You may use a WordPress plugin and that would be more easy for you. Use this plugin Pinterest Pin It Button For Images. Either search it on WP Plugin search or click the link and upload the folder to the /wp-content/plugins/ directory, Activate from ‘Plugins’ menu and Enjoy.

Hide Post Images Without Removing Thumbnail Image In Category Archive

Given code hides post images but keeps thumbnail image in Category archive and homepage. Add following code block in your theme’s function.php:

function wpi_image_content_filter($content){

if (is_home() || is_front_page() || is_category()){
$content = preg_replace(“/<img[^>]+>/i”, “”, $content);
}

return $content;
}
add_filter(‘the_content’,’wpi_image_content_filter’,11);

Facebook Marketing Team Released Facebook Posters For Your Business

Facebook marketing team has released posters that you can use in your business stores after printing them. Its PDF so you can print them and put it in your office, stores or anywhere you want to encourage your clients, customers and others who visit your business place to join your page on Facebook. Also if you like you may put it in your website linking to your Facebook page but these posters are better for using as printable posters and for websites those old Facebook badges are fine.

Download all posters from here: http://ads.ak.facebook.com/ads/FacebookAds/Facebook_Signs.pdf

How To Grant Privilege To Any MySQL Database User ?

GRANT command is be used for giving privilege to any user for accessing database.

GRANT PRIVILEGES ON DATABASE OBJECTS TO USER@HOST IDENTIFIED BY ‘PASSWORD’;

Example:

For granting privilege to user  admin Use:

GRANT ALL PRIVILEGES ON *.* TO ‘admin@localhost’ IDENTIFIED BY ‘secret’;

For specifying the username and password which is used while staring MySQL is:

mysql –h hostname –u username –p password

When you don’t want users to access any other database tables then replace* (as shown below) with database name of that particular user whom you want to limit access to other database tables:

GRANT ALL PRIVILEGES ON ‘store’.* TO ‘admin@localhost’ IDENTIFIED BY ‘secret’;

Run given command with root permission. In the given command ‘store’ correlates to the name of database to which the privileges are assigned.

Adblock Plus For Annoyance-free Web Surfing

Adblock Plus is good if you need to block  undesirable website elements to appear on web pages while you are surfing the internet. Subscribe a free filter service and add undesirable website elements to the block list with just a single click.

Use sudo apt-get install xul-ext-adblock-plus command to install this app from your Linuc terminal.

Visit Firefox >> Tools >> Add-ons >> Get Add-ons >> Search All Add-ons >> AdBlock Plus to add Addblock extension to your Firefox web web browser.

Visit Adblock Plus Webiste

Inexpensive And Surprisingly High Quality Hardware Fine Working With Android Jelly Bean Will Make Largest Possible Market For Nexus 7 In India

Inexpensive and Surprisingly high-quality hardware fine working with Android Jelly Bean will make largest possible market for Nexus 7 in India. If Google integrates Universal Free Education System (that primarily works in India’s Language) in Nexus 7 in its release in India then I am sure it would be attracting 1.21 billion people of India because they would be learning the most advanced technology in their language and that would be changing the geopolitical structure of Internet and Google too because only 121 million Indians are active on Internet from 1.21 billion overall guessed population. Currently 929.37 million Indians are using mobile devices because its inexpensive and easy as they don’t need any education for that. Hence, it would be good if Google targets them first.

Nexus 7 Is Getting Towards Very High Demand In Comparison To Other Tablets. 16GB Model Is Sold Out

Nexus 7 16GB Is Sold Out. Google is not taking any more orders for Nexus 7 16GB: https://play.google.com/store/devices/details?id=nexus_7_16gb No idea when it will be available again. Still, buyers may leave an email message for Nexus 7 16GB model and Google will notify them as soon the model get available. Nexus 7 8GB model is still available. Although demand for smaller 8GB version is comparatively low than 16GB one.

WordPress’s VIP Team Launched New Plugin That Controls Bulk User Management On Multisite Network

VIP team launched new plugin which is capable enough to control and manage all users across many sites in a multisite network install. It can check all network users and their roles on different sites sites and helps you to edit users, user roles on different sites at a time without visiting their dashboard from All Sites Super Admin Menu.

Linux 3.5 Kernel Is Released

Linux 3.5 has been released on 21 Jul 2012.

This release includes support for metadata checksums in ext4, userspace probes for performance profiling with tools like Systemtap or perf, a sandboxing mechanism that allows to filters syscalls, a new network queue management algorithm designed to fight bufferbloat, support for checkpointing and restoring TCP connections, support for TCP Early Retransmit (RFC 5827), support for Android-style opportunistic suspend, btrfs I/O failure statistics, and SCSI over Firewire and USB. Many small features and new drivers and fixes are also available.

Read Morehttp://kernelnewbies.org/Linux_3.5

Facebook Is Less Trusted With Personal Data Than Others

Fewer Internet users trust Facebook with personal data than other Internet companies.

According to Harris Interactive Inc. Survey:-

  • 1/3rd Internet users says that they are comfortable with Facebook’s policy of handling personal information
  • 41% respondents trust Google to show ads based on past Web searches.
  • 66% percent, are comfortable with Amazon using data on past purchases to recommend products.

Page Links To WP plugin allows you to…

Page Links To WP plugin allows you to make a WordPress page or post point to a URL of your choice instead of traditional URL of WP page or post. Also useful when you move your blog or create a new post instead of updating the old one. It can also redirects people who go to the old URL to the new one you’ve chosen.

PHP Was Never Written In Perl

Morons keep assuming that PHP was written in Perl. Wikipedia is spreading this false notion. Wikipedians take words of Rasmus Lerdorf less reliable. It is visible on Wikipedia page history that many tried to correct this mistake but its bureaucratic approach had undone all that.

Even the creator of PHP Rasmus Lerdorf  himself says that PHP was never witten in Perl and real world doesn’t require any other source not even Wikipedia to confirm the truth. Simply learn PHP and it is not Perl. Actually Wikipedia was using the Wiki written in Pearl before Magnus Manske actually recreated Wikipedia in PHP. That very stuff is named by Wiki Media Foundation  as MediaWiki.

Know what PHP is: PHP is one of the most popular and widely used server side scripting language which used for creating dynamic webcontent and applications that interact with the user offering customized information. PHP originally stood for Personal Home Pages but somewhere the acronym get changed to Hypertext Pre-processor.

PHP has given new dimensions to the lives of Jimmy Wales, Mark Zuckerberg and many others. Where Jimmy Wales started from Bomis.Com providing free to premium access of users to X-rated content. Later-on he gained huge amount of credibility after founding Wikipedia. And Mark Zuckerberg, who had almost no friends created Facebook which is now the largest social networking system.

Wikipedia and Facebook are different frameworks but they both run on PHP. WordPress is also PHP programmed most popular blogging platform. So better don’t take any wrong idea about this dominant web-technology. PHP was never written in Perl and in this regard Wikipedia is less reliable than Rasmus Lerdorf.