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
When you put some URL and email address you need to manually add the link URL to that text. This action always takes the some time of wordpress blogger. WordPress has facility to add the links to your URL and email address automatically.
convert plain text URI to HTML links in wordpress
This facility is available in wordpress since wordpress 2.7 version but many wordpress theme and plugin developers never used this functionality.
WordPress provides the make_clickable() function for convert plain text URI to HTML links. This function able to convert URI, www, ftp, and email addresses. Finishes by fixing links within links. You just need to pass the string parameter to this method.
More detail information you can find in following file.
wp-includes/formatting.php.
You can use this method in your functions.php file also. Use the following code.
add_filter('the_content', 'make_clickable');
By using this code you are able to covert the URI, www, ftp, and email addresses in to link.
If you are having any issues or question about make_clickable method then please write to me.
Many times you want to show the popular posts in your wordpress theme and you use popular post wordpress plugin or widget for showing the popular posts in your wordpress theme. As much possible you need to avoid the wordpress plugins for minimal code.
most popular posts wordpress without plugin
With very easy steps you can fetch the most popular posts from your wordpress. Most common trick or technique is on comments base you can fetch the popular posts.
You just need to open your functions.php file from wordpress posts and put following code in file.
// Get Most Popular Posts in theme
function popular_posts_by_comments( $posts = 5) {
$popular = new WP_Query('orderby=comment_count&posts_per_page='.$posts);
while ($popular->have_posts()) : $popular->the_post();
?>
<li>
<div>
<a title="<?php the_title(); ?>" href="<?php the_permalink() ?>"><?php the_title(); ?></a>
<span><?php comments_popup_link('0 Comment', '1 Comment', '% Comments', 'comments-link', ''); ?></span>
</div> <!--end .info-->
<div></div>
</li>
<?php endwhile;
}
This is very easy code to fetch you wordpress popular posts. Here I am fetching only 5 popular posts from wordpress. You can fetch the multiple popular posts by changing the $post variable value.
In wordpress theme sidebar or footer section if you want to show the popular post then just use following code.
When we login to wordpress admin area that time we first saw the admin dashboard. Many tabs and section are not useful in admin dashboard section for wordpress admin and sometimes we don’t know what is that sections.
Remove Unwanted Meta Boxes from wordpress dashboard through wordpress theme
We saw the right now, recent comments, quick press, stat, recent drafts, incoming links, wordpress development blog, other wordpress news, plugins and more sections in wordpress dashboard section. Most of that section are not useful to wordpress admin. So is that better to remove unwanted section from dashboard.
Remove Unwanted Meta Boxes from wordpress dashboard through wordpress theme
For disable the dashboard section we are going to use the wp_dashboard_setup method. In wordpress dashboard there are multiple meta boxes listed. some of them as follows:
For removing the widgets or meta boxes from dashboard you need to open your functions.php file from wordpress theme folder and put following code in that file.
how to prevent direct access to images. To protect your images or media file you should use apache rewrite rules. To protect being linked on another website. To protect your images or media file you should use apache rewrite rules. To protect your images or other files from being linked or used on another website. Due the this issue your images may be used by many sites.
how to prevent direct access to images
how to prevent direct access to images
The Apache Server’s Mod Rewrite Engine can examine the name of the document requesting a file of a particular type. If the URL of the page requesting the image file is from an allowed domain, display the image. Otherwise, return a broken image.
There are many people who try to use your website images. That will cut your bandwidth so using this code is good idea.
You can use following apache code in apche config file or put following code in your .htaccess file.
Second thing you should do. you should create the dummy index.html file and put in your images folder for so any visitor will not see the directory listing of images.
If you use above code then when other domain try to see or use the your images then they will see the following error message.
it will result in a Forbidden error.
Still if you are having any issue or question then write to me.
WordPress tutorial for, In this article we will show, how to Create multiple widgets in wordpress theme. Widgets for very important in wordpress themes and plugins. First I need to tell you this widget api is located in following file.
wp-includes/widgets.php
For enable the sidebar support in wordpress theme you need to register atleast one sidebar in wordpress api. For enabling the side bar you need to just open the functions.php file and put following code in that file.
if ( function_exists('register_sidebar') )
register_sidebar();
This is enable the global sidebar for your wordpress theme.
If you want multiple sidebar in your wordpress theme then use the following code. I created two sidebars in my wordpress theme. First is normal sidebar and second is footer sidebar.
For main sidebar showing just open your sidebar.php file put following code in that file.
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Main Sidebar') ) :
endif;
For showing second widget in footer section open your footer.php file and put following code in that file.
if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Footer Sidebar') ) :
endif;
Then go to your widget section through admin panel and select your widget which you want to show in widget sections.
Create multiple widgets in wordpress theme
If you are having any issues or question about using widget in wordpress theme then write to me.
Short code api is introduced in wordpress from 2.5 version. Since short code is very popular and used by wordpress plugin developers. Many wordpress theme and plugin developers do use the shortcode api regularly.
how to use shortcodes in wordpress posts
how to use shortcodes in wordpress posts
Using shortcode api is very easy. If you want to use the shortcode in your wordpress theme then open your functions.php file and put following code. Here is example for using shortcode.
function wordpressapi_content() {
echo "Hello World";
}
add_shortcode('wordpressapi_content', 'wordpressapi_content');
Create any page and just put following line in that post or page.
[wordpressapi_content]
If you put following code in your page or post then you can see the hello world content in your page or post.
If you want to add the google adsence using shortoce then use the following code.
Last month I went to Ganpatipule from Pune. I visited Ganpatipule for 3 to 4 times and I went to ganpatipule from many routes. In this article I will tell you which is best road route for going to Ganpatipule.
pune to ganpatipule route by car distance 330 km
Important : Dont take mulshi and Mahad route. Actually when you search in google maps you first got that route. But roads are not good on that route and that is not very nice route.
Kubharli Ghat pune to ganpatipule route by car distance 330 km
Take NH4 Highway route. First go to Satara -> Umbraj. From Umbraj take right turn to patan gaon. Patan-malharpeth then go to Helwak -> Kumbharli Ghat – then go to Chiplun. From Chiplun If you want to go by short cut then go from Dangli Akhli road. You need to ask there How to reach Ganpatipule from Dangli Akhli road.
Dont go to Hathkambha take dangli akhali road that will save you 35 to 40 kilometers road.
Nice places between Road. You must see the konanagar Dam and For seeing the dam you need to take pass from the Dam office. You should see the Nehru Garden. This garden is very nice and clean and big. From this garden you can see the dam. Between the road you will see the many monkey in Kumbharli Ghat but dont stop the car and dont feed the money because that monkeys are not good. Between Kumbharli Ghat you will see the many waterfalls.
Ganpatipule Beach
Stay at Ganpatipule- You will get very nice rooms at ganpatipule for rated only 600 to 800. That will enough for one family or 6 to 8 people. With four bedroom and attached bathroom.
Food is also very cheap and nice. For 40 to 50 rupees you will get the thali.
Ratnagiri Beaches –
AreWare beach – 13 Km from Ganpatipule, Nice clean, lonely and safe beach
Ratnagiri Light House – 26 Km from Ganpatipule, You should see this.
Bhatya Beach – 26 km from Ganpatipule, Nice place but not nice beach
Madvi Beach – 32 km from Ganpatipule, Nice , lonely but not safe beach
There are many webmaster and blogger who want to make money through online ads. Many people use the google adsence for making online money. Google adsence pay on your cost per click (CPC). Many times your user click on ads but still you dont get good amount of revenue. Because click-through-rate or CTR of your ads which displays on your website is very low. Most of the clicks are worth as low as $0.01 per click.
Google adsense MFA website list for bloggers
Some people may be heard about what is MFA (Made for Adsence). MFA sites owners make lowest bid for adsence. So when that ads displays on your site and user clicks on that ads then you got minimum revenue. you need to block those site through google adsence.
I created the list of websites you need to blog from your google adsence. Here is list of websites you need to block.
Some time I found some issues with Drupal site. When we make changes in javascript or in PHP code we need to clear the cache from Drupal site. One time I got really weird issue. I am not able to access my druapl admin also.
delete drupal cache manually through mysql
Then I found only one option which is I need to clear the cache from Drupal. Using Drupal admin panel we can easily delete the drupal cache but how can I delete the drupal cache manually. We can delete the Drupal cache through mysql also.
For that you need to use following mysql commands in phpmyadmin or through mysql command line.
[viral-lock message=”Solution code is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]
[mysql]
DELETE FROM cache;
DELETE FROM cache_filters;
DELETE FROM cache_menu;
DELETE FROM cache_page;
DELETE FROM watchdog;
[/mysql]
[/viral-lock]
above mysql commands will clear all the cache from drupal. If you want more drupal tutorials than visit here
Many new web developers or web application developers may be did not hear about reset CSS. Many web developers use the global selectors and global CSS styling. That is very basic reason behind that. They want to display their CSS style across the various browsers.
What is reset css and How to use the reset CSS
The goal of a reset stylesheet is to reduce browser inconsistencies in things like default line heights, margins and font sizes of headings, and so on. With reset CSS you are overriding the setting of various browser setting and elements. There are inconsistencies with every browser. For reducing the issues and setting of browser you need to reset the browser properties.
What is reset css and How to use the reset CSS
With reset CSS you can set the border, font color, color, margin, padding, img, h1, a, etc properties. The problem is that every browser’s stylesheet has subtle but fundamental differences. By using a CSS reset. There are many big sites and tool available for using the reset the CSS.
In reset CSS you need to use the most common HTML tags and their properties for reset there CSS properties.
you can also create you reset CSS as per your website need. There are many useful and good reset available. I like the YUI reset CSS most because that is really useful.
For using the YUI reset CSS you need to just add the following line in your website.
Reset CSS is really useful for every website. do use the reset CSS in you stylesheet. There is another good reset CSS called blueprint which you download from following URL. http://code.google.com/p/blueprintcss/.
Some people are saying dont use the reset css because that will increase the your css size but I must admin this thing.
you should use the reset css that will save your big time.