PurabTech is technical blog for Programmer and Coders
Author: Purab
I am Purab from India, Software development is my profession and teaching is my passion.
Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks.
Purab's Github Repo
Youtube Chanel Video Tutorials
Connect to on LinkedIn
WordPress plugin tutorial, wordpress plugin create table on activation, If you are making plugin and in plugin many times we need to create new tables. In this article I will show you how easily we can create the wordpress plugin.
wordpress plugin create table on activation
wordpress plugin create table on activation
Using following code you can create the table in wordpress database.
global $jal_db_version;
$jal_db_version = "1.0";
function jal_install () {
global $wpdb;
global $jal_db_version;
$table_name = $wpdb->prefix . "liveshoutbox";
if($wpdb->get_var("show tables like '$table_name'") != $table_name) {
$sql = "CREATE TABLE " . $table_name . " (
id mediumint(9) NOT NULL AUTO_INCREMENT,
time bigint(11) DEFAULT '0' NOT NULL,
name tinytext NOT NULL,
text text NOT NULL,
url VARCHAR(55) NOT NULL,
UNIQUE KEY id (id)
);";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
$rows_affected = $wpdb->insert( $table_name, array( 'time' => current_time('mysql'), 'name' => $welcome_name, 'text' => $welcome_text ) );
add_option("jal_db_version", $jal_db_version);
}
}
Now that we have the initialization function defined, we want to make sure that WordPress calls this function when the plugin is activated by a WordPress administrator. To do that, we will use the activate_ action hook. If your plugin file is wp-content/plugins/plugindir/pluginfile.php, you’ll add the following line to the main body of your plugin:
When you start writing post in wordpress panel. WordPress has facility to autosave the post with in every one minute. modify autosave Interval in wordpress.
how to modify autosave Interval in wordpress
how to modify autosave Interval in wordpress
When editing a post, WordPress uses Ajax to auto-save revisions to the post as you edit. You may want to increase this setting for longer delays in between auto-saves, or decrease the setting to make sure you never lose changes. The default is 60 seconds.
This really good feature of wordpress but sometimes this became very painful to blogger because of revision posts and size to database. Due to post revision wordpress post table size increases and Due to that database became slower.
So I recommend to change the auto save time of your wordpress.You can change the ‘auto-save’ time of wordpress blogs by your own time limit. This task invloves changin the configuration of AUTOSAVE_INTERVAL constant and replacing the given time interval by your time.
Just follow my steps very carefully. Open the wp-config.php file which you can find in your wordpress root folder.
and find the following sentence.
define('AUTOSAVE_INTERVAL', 60 ); // seconds
and change that to following
define('AUTOSAVE_INTERVAL', 180 ); // seconds
After doing this change upload wp-config.php file to server again. After this change Auto save will start after 3 min instead of 1 minute.
We all know what is excerpt. In wordpress using excerpt is good idea. WordPress provides the inbuild function called the_excerpt. Many people want to to show first few words on the theme front page. For that this function is very useful.
How to use the_excerpt in WordPress
How to use the_excerpt in WordPress
If you do not provide an explicit excerpt to a post (in the post editor’s optional excerpt field), it will display an automatic excerpt which refers to the first 55 words of the post’s content. Also in the latter case, HTML tags and graphics are stripped from the excerpt’s content.
Important Note: the_excerpt function must be written in The Loop.
For using the excerpt tag you need to put following code in the loop.
Some times you need to put excerpt tag conditionally. In archive or category and home page you want to show only the excerpt of post then you can use following code:
If you want to Control Excerpt Length using Filters use following code. To change excerpt length using excerpt_length filter, add the following code to functions.php file in your theme:
function new_excerpt_length($length) {
return 20;
}
add_filter('excerpt_length', 'new_excerpt_length');
use the_excerpt in WordPress
Tip: You can Remove […] string using Filters.By default, excerpt more string at the end is set to ‘[…]’. To change excerpt more string using excerpt_more filter, add the following code to functions.php file in your theme:
function new_excerpt_more($more) {
return '[.....]';
}
add_filter('excerpt_more', 'new_excerpt_more');
If you want to make read more link after excerpt then use following code:
function new_excerpt_more($more) {
global $post;
return '<a href="'. get_permalink($post->ID) . '">' . 'Read the Rest...' . '</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
Firefox is mostly used by programmers and developers and designers as well. Here we have Best firefox addons for increase developers productivity. Now these days Firefox become so popular and so many common people are also started using the firefox for daily basis.
Best firefox addons for increase developers productivity
Firefox provides the very useful plugins or you can call as addon. Here are the list of some very popular and useful firefox addon list for increase your productivity.
Best firefox addons for increase developers productivity
CookieSafe is a useful extension that allows you to block cookies quickly for any given site. You can also control cookie permissions on a global level.
Remove Cookies for Site on the other hand allows you to quickly delete cookies for any site from the context menu. We can’t live without this one, since it definitely saves a whole load of time.
FastDial is a extension that brings a new feature to Firefox, which is available in Opera by default. FastDial replaces your home page
and allows you add and quickly access your favorite websites by displaying small thumbnails, clicking on which will take you to the website.
Though there may be several ways in which you can access your favorite websites, we prefer FastDial since it allows us to quickly access all our favorite sites when we open up a new tab.
There are several times when we have closed a tab by mistake, it was quite a pain to go back to the history and find out which tab we had closed. Undo Closed Tabs Button is a real life saver since it allows you to open the last closed tab with just the click of a button.
Since we spend a lot of time using Firefox, we prefer to use ReminderFox for several reasons. It definitely saved us a lot of time remembering birthdays, anniversaries, paying of cable and Internet bills and more without having to maintain another application
just for reminding us about important dates and events.
The default Firefox downloads window is pesky and keeps cropping up on us when a file starts to download and finishes downloading, we prefer to silence it once and for all using Download Statusbar a handy extension that will create a tiny little icon for downloads and put it in your statusbar.
Shareaholic is a great add-on for clubbing in several social networking tools into one, you can easily digg a page, stumble it, add it to facebook, reddit it, tumble it, save it to del.icio.us and more.
Following Firefox Addons are useful for programmers,
Web Developer is a powerful extension for developers. It definitely makes developing web pages quite easy. You can modify CSS on the fly, see which layers are using which styles, modify cookies, play around with images and practically do anything you would want to do as a developer.
User Agent Switcher quickly allows the user to change the user agent of the browser to see the behavior of web pages under different browsers.
Delicious Bookmarks
Delicious Bookmarks is the official Firefox add-on for Delicious, the world’s leading social bookmarking service (formerly del.icio.us). It integrates your bookmarks and tags with Firefox and keeps them in sync for easy, convenient access.
It will capture what you can see in the window, the entire page, just a selection, a particular frame… basically it saves webpages as images – either to a file, or to the clipboard. It captures Flash too!
With ColorZilla you can get a color reading from any point in your browser, quickly adjust this color and paste it into another program. You can Zoom the page you are viewing and measure distances between any two points on the page. The built-in palette browser allows choosing colors from pre-defined color sets and saving the most used colors in custom palettes. DOM spying features allow getting various information about DOM elements quickly and easily. And there’s more…
If you think there are more good firefox plugin than please suggest me.
A bit better than the above tool, this utility can give you both read and write access to Ext2 and Ext3 Filesystems from Windows. Plus, once you have this installed, Windows can use it your Linux partition as a paging file as well.
ReiserDriver allows access to ReiserFS partitions from Windows. The partitions appear like other filesystems, and can be accessed by any windows application. This is yet in kinda like pre-release stage, and installation should prove tedious for newbies.
DiskInternals Linux Reader has a Windows Explorer like interface, and can provide access to Ext2 and Ext3 Linux partitions from Windows. You can extract files easily from those linux partitions to your Windows partitions.
Many people faced memory issue wordpress and WordPress itself uses the so much memory. By default wordpress uses the 32mb memory. shown you to increase memory allocation for wordpress using config file.
increase memory allocation for wordpress
First you need to know what is the use of increasing the memory limit for wordpress. If I increase the WP_MEMORY_LIMIT from 32M to 64 or 96M will it make my website load fast.
We can adjust the amount of memory using the wp-config.php file.
define('WP_MEMORY_LIMIT', '96M');
Many shared hosting provides the default memory for php. What I see most commonly shared hosting set the memory limit to 8mb or 16mb. They does not allow you to increase the php memory limit and in that case if you changed the wp-config file then also there is no use of that change.
increase memory allocation for wordpress
What that setting do?
This setting increases PHP Memory only for WordPress, not other applications. By default, WordPress will attempt to increase memory allocated to PHP to 32MB (code is at beginning of wp-settings.php), so the setting in wp-config.php should reflect something higher than 32MB.
In this article I will tell most famous and downloaded wordpress themes. Some of worpdress themes are so much popular and highly used by the blogger and Some wordpress themes are downloaded record time.
Most famous wordpress themes
In article we will tell Most famous wordpress themes and downloaded wordpress themes. Some of worpdress themes are so much popular and highly used by users
Here are some very famous wordpress themes among wordpress users and following wordpress themes are downloaded mostly and all the time.
Here we have linux tutorial for, how to open port 80 in linux iptables. Many times we need to open 80 port on linux box. Through command line opening the 80 or any port that is easy. In this tutorial I will how you can open the port 80.
using following command you can save the setting in iptables.
[root@sonyk-pc project]# restorecon -R /etc/sysconfig/iptables
[root@sonyk-pc project]# service iptables save
iptables: Saving firewall rules to /etc/sysconfig/iptables:[ OK ]
Than restart the firewall using following command
[root@sonyk-pc project]# service iptables restart
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: nat mangle filte[ OK ]
iptables: Unloading modules: [ OK ]
iptables: Applying firewall rules: Using intrapositioned negation (`--option ! this`) is deprecated in favor of extrapositioned (`! --option this`).
Using intrapositioned negation (`--option ! this`) is deprecated in favor of extrapositioned (`! --option this`).
[ OK ]
In wordpress 3.0 limiting the excerpt is very easy. the_excerpt function is very useful and helpful in wordpress. In wordpress limiting the excerpt is very easy. With our code you can set post excerpt length to limited characters in wordpress. the_excerpt function is very useful and helpful in wordpress.
set post excerpt length to limited characters in wordpress
set post excerpt length to limited characters in wordpress
In many wordpress theme we used the excerpt. Many times we need to control excerpt characters as per our wordpress theme requirement. You can easily change the excerpt length using wordpress hook.
You just need to open your functions.php file from your wordpress theme folder and put following code in that.
function change_excerpt_length($length) {
return 100;
}
add_filter('excerpt_length', 'change_excerpt_length');
This filter is used by wp_trim_excerpt() function. By default the excerpt length is set to return 55 words.
In article, we have a list of best free premium wordpress themes for download which are available free download. searching for free premium wordpress themes. Everybody was searching for free premium wordpress themes for download. Many people thought there are very nice wordpress themes but that are not freely available. Here in this article I created a list of premium wordpress themes which are available for free download.