How to use bloginfo in wordpress theme

For each wordpress theme developer the bloginfo() function is very useful. If you are not used the bloginfo function then use the bloginfo function. There is great help is provided wordpress api. In every wordpress theme we need to use the bloginfo method. bloginfo() function is useful. If you not used bloginfo function than use bloginfo function. Every theme we need to use bloginfo in wordpress theme.

How to use bloginfo in wordpress theme

How to use bloginfo in wordpress theme
How to use bloginfo in wordpress theme

Displays information about your blog, mostly gathered from the information you supply in your User Profile and General Options from the WordPress Administration panel.

Following parameter is passed in this method.


name = TestWpapi
description = Just another WordPress blog
admin_email = admin@example

url = http://example/home
wpurl = http://example/home/wp

stylesheet_directory = http://example/home/wp/wp-content/themes/child-theme
stylesheet_url = http://example/home/wp/wp-content/themes/child-theme/style.css
template_directory = http://example/home/wp/wp-content/themes/parent-theme
template_url = http://example/home/wp/wp-content/themes/parent-theme

atom_url = http://example/home/feed/atom
rss2_url = http://example/home/feed
rss_url = http://example/home/feed/rss
pingback_url = http://example/home/wp/xmlrpc.php
rdf_url = http://example/home/feed/rdf

comments_atom_url = http://example/home/comments/feed/atom
comments_rss2_url = http://example/home/comments/feed

charset = UTF-8
html_type = text/html
language = en-US
text_direction = ltr
version = 2.9.2

following is examples for using the bloginfo() method.

//Show Blog Description

//Show Blog Title

//ading the style.css
//ping back url
//for content type

How to use the bloginfo() function in wordpress theme
How to use the bloginfo() function in wordpress theme

accidentally deleted mysql root user

Some time back I accidentally deleted mysql root user. Then when checked mysql then mysql is not accessible to me from root user. I have the trick to restore mysql database.

accidentally deleted mysql root user

I am using the fedora 14 on my machine. After trying so many things at the end I found the solution.

use the following steps:

First I stoped mysql using following command.

#/etc/init.d/mysqld stop

Then I created one file with following conent

#file mysql_reset

UPDATE mysql.user SET Password=PASSWORD(‘newpassword’) WHERE User=’root’;

#mysqld_safe –init-file=/home/techiego/mysql-init &

Than again I stooped mysql process and restarted mysql. I was able to access my mysql again.

accidentally deleted mysql root user
accidentally deleted mysql root user

Import wordpress attachment without download images

Everybody knows how to use the wordpress import and export functionality. When you don’t want to download the wordpress post attachment (images, files) then you should follow my steps. Using following steps you are able to import all the attachment data without downloading the images.

Import wordpress attachment without download images

First Open your old wordpress installation and then go to wordpress panel. Then open your phpmyadmin of old wordpress installation and run following query.

update `wp_posts` set `post_type`='image' where `post_type`='attachment';
Import wordpress attachment without download images
Import wordpress attachment without download images

This query will create the image post type and attachments will become like post type. Then use the wordpress export and download exported xml.

 

Then open your new wordpress admin and click on import button and import the whole xml file.

You will see the you selected the download and import file attachments option but files are not downloaded.

Then through ftp client transfer all your image and files to new installation. Then open phpmyadmin of new wordpress panel and use following command.


update `wp_posts` set `post_type`='attachment' where `post_type`=image';

Now you are able to see the images in new wordpress panel and website.

Import wordpress attachment without download images
Import wordpress attachment without download images

Bluehost : Mailer Error: SMTP Error: Could not connect to SMTP host

I am using the bluehost for my some sites hosting. For sending emails I used the SMTP service which is provided by bluehost.

Bluehost : Mailer Error: SMTP Error: Could not connect to SMTP host

I used the PHPmailer in my website for sending email. When I tried to use the bluehost SMTP I always got the following error message.

Mailer Error: SMTP Error: Could not connect to SMTP host.”

I solved this issue. I created the following function.


<?php
include("class.phpmailer.php");

function mail_new($fun_to,$fun_subject,$fun_body,$fun_header,$fun_from,$fun_cc){
$mail = new PHPMailer();

$mail->IsSMTP();                                      // set mailer to use SMTP
$mail->Host = "mail.eparinay.com";  // specify main and backup server
//$mail->SMTPSecure = "ssl";                 // sets the prefix to the servier
$mail->SMTPAuth = true;     // turn on SMTP authentication
$mail->Username = "support@purabtech.in";  // SMTP username
$mail->Password = "YOURPSSSWORD"; // SMTP password
$mail->Port       = 26;

$mail->From = $fun_from;
$mail->FromName = "eparinay.com";
$mail->AddAddress($fun_to);
$mail->AddReplyTo($fun_from, $fun_from);

if($fun_cc!=""){
$mail->AddAddress($fun_cc);
}
$mail->WordWrap = 50;                                 // set word wrap to 50 characters
//$mail->AddAttachment("/var/tmp/file.tar.gz");         // add attachments
//$mail->AddAttachment("/tmp/image.jpg", "new.jpg");    // optional name
$mail->IsHTML(true);                                  // set email format to HTML

$mail->Subject = $fun_subject;
$mail->Body    = $fun_body;
//$mail->AltBody = "This is the body in plain text for non-HTML mail clients";

if(!$mail->Send())
{
echo "Message could not be sent. <p>";
echo "Mailer Error: " . $mail->ErrorInfo;
exit;
}
}
?>

Where you want to use the mail you just need to include the above script and call the “mail_new” function for sending email through bluehost.

Bluehost - Mailer Error- SMTP Error- Could not connect to SMTP host
Bluehost – Mailer Error- SMTP Error- Could not connect to SMTP host

how to add virtual host in wamp server

In this tutorial we shown, how to add virtual host in wamp server on windows machine. You just need to follow our steps to setup virtual host in wamp server.

how to add virtual host in wamp server

Many PHP developers use the wamp server for development. For creating the virtual host just open the httpd.conf file from following location.

how to add virtual host in wamp server
how to add virtual host in wamp server


C:\wamp\bin\apache\Apache2.2.11

Then un-comment the following line


# Virtual hosts
Include conf/extra/httpd-vhosts.conf

Than open the httpd-vhosts.conf file from following location


C:\wamp\bin\apache\Apache2.2.11\conf\extra\

un-comment the following line


NameVirtualHost *:80

then put the following lines in that file



#ServerAdmin webmaster@dummy-host.localhost
DocumentRoot "C:/wamp/www"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
<!--<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->VirtualHost>


#ServerAdmin webmaster@dummy-host2.localhost
DocumentRoot "C:/wamp/www/wordpress"
ServerName wordpress.purab.com
ErrorLog "logs/wordpress.purab.com-error.log"
CustomLog "logs/wordpress.purab.com.log" common


Then restart the wamp server. Dont forget to update the hosts file from your system

Open the hosts file from following location.


C:\Windows\System32\drivers\etc

put entry like this.

127.0.0.1       localhost    localhost.localdomain    local.purabtech.in

Have fun!

Media Library not displaying images after importing posts

Earlier I have blog in wordpressmu  then after wordpress 3.0 version I decided to migrate to new version. I exported my all posts by using the wordpress  export tool. Then I imported data into new wordpress installation. I got all my posts and category and all the data. Then I checked all my attachments.

Then I saw my media library I saw all the images listing are there but images are not showing in media library. Media Library not displaying images after importing posts. I personally faced issue and got frustrated. then I solved issue myself using mysql query trick.

Media Library not displaying images after importing posts

Media Library not displaying images after importing posts
Media Library not displaying images after importing posts

When I checked my database I saw the all the my attachments are listed in post table but images are not displaying. All the places I only saw the wp-includes/images/crystal/default.png image.

I did spend one hour googled for solving the issue but I did not find any solution for this. Than again I checked my Folder permissions and images files but I found all things are perfect.
Then I checked my database and I found the issue. in wp_posts table ->post_mime_type column one entry was missing. After seeing that issue I fixed the issue.

I used the following mysql quires using myphpadmin tool.

[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.”]

Update wp_posts set post_mime_type='image/jpg' WHERE guid like '%jpg%'
Update wp_posts set post_mime_type='image/jepg' WHERE guid like '%jepg%'
Update wp_posts set post_mime_type='image/png' WHERE guid like '%png%'
Update wp_posts set post_mime_type='image/gif' WHERE guid like '%gif%'

[/viral-lock]

After using above query I checked the my media library. I am able to see my all images in media library.

My advise to you is first take backup of your database and then use above mysql quires. Then use the above queries.

If you are imported post from other website then use following commands also.


UPDATE wp_posts SET post_content = REPLACE(post_content, 'NEW-DOMAIN-NAME', 'files/');

UPDATE wp_posts SET post_excerpt = REPLACE(post_excerpt, 'NEW-DOMAIN-NAME', 'OLD-DOMAIN-NAME');

UPDATE wp_posts SET guid = REPLACE(guid, 'NEW-DOMAIN-NAME', 'OLD-DOMAIN-NAME');

Above quires will change the domain location of file.

How to speed up wordpress blog or site

Many wordpress blogger always spending some time for speeding up there blogs. In this aritcle I will tell you how you can speed up your wordpress blog with easy steps. Loading your website is very important. If your blog or site not more fast then bounce rate of your website will be high.

 speed up wordpress blog

There is apache module called zlib. which is used for compression.

zlib is a lossless data-compression library that will help you to serve your pages faster. This will compress the static data of your website. like images, css and media and javascript files. It compresses the PHP that WordPress sends to your visitor’s browser so that it displays much more quickly. Compressing and sending is much faster than sending the PHP in its full size format.

 speed up wordpress blog
speed up wordpress blog

If you are using dedicated hosting service then easy to make changes in your files but if you are using the shared hosting then first you need to check zlib compression is available or not.

For checking zlib library create the phpinfo() file and see the zlib is there or not.

Mostly 99% shared hosting gives zlib compression facility. Just open your header.php file from your wordpres theme folder and following code in that file in top of file section.


<?php
ini_set(’zlib.output_compression’, ‘On’);
ini_set(’zlib.output_compression_level’, ‘1′);
?>

This change will save your bandwidth and webpage will load faster. you can see the result after doing this change. In my site I saw the difference.

Website will load 3 to 4 times faster than earlier.

 speed up wordpress blog
speed up wordpress blog

WordPress 3.0.3 released with Fixes issues

Some time before on 8th December WordPress released the New version which is 3.0.3. What wordpress is saying about this release.

WordPress 3.0.3 released with Fixes issues in the XML-RPC remote publishing interface

Wordpress 3.0.3 released with Fixes issues
WordPress 3.0.3 released with Fixes issues

This release fixes issues in the remote publishing interface, which under certain circumstances allowed Author- and Contributor-level users to improperly edit, publish, or delete posts.

These issues only affect sites that have remote publishing enabled.

Remote publishing is disabled by default, but you may have enabled it to use a remote publishing client such as one of the WordPress mobile apps. You can check these settings on the “Settings → Writing” screen.

With this release they Improved the capabilites checking in the XMLRPC code. They modified the following files.

wp-includes/version.php
xmlrpc.php
readme.html
wp-admin/includes/update-core.php

Enjoy the wordpress 3.0.3 version.

how to generate Facebook fan code

Many people want to add the facebook fan code and like button in your website for fb page. we given information about how to generate Facebook fan code.

how to generate Facebook fan code

For generating the facebook fan code just go to following URL:

http://developers.facebook.com/docs/reference/plugins/like-box

Just put your facebook page url in URL section. specify the width of widget and color scheme. then uncheck the show header and show stream checkbox.

how to generate Facebook fan code
how to generate Facebook fan code

If you want to show the connected photos then put value in connections textbox. But I recommend to use the zero value in that because that will slowdown your website. Then click on get code button. Then you will see the facbook in page popup. As per my suggestion use the iframe tag. Do not use the javascript tag for your website.

That will again for your website performance related. As much script tag you include in your website that much slowness will happen to your website.

Then use the iframe tag code in your website.

If you are using the wordpress then just use the text widget for showing your facebook fan widget.

If you are having any issues or questions about adding the facbook fan code in your website then please write to me.

 

how to generate Facebook fan code
how to generate Facebook fan code

wordpress pagination style without wordpress plugin

wp-pagenavi is most popular. wordpress pagination style without wordpress plugin, We need to install wp-pagenavi wordpress plugin for pagination styling.  When we think wordpress pagination style then first thing came in mind which is. We need to install wp-pagenavi wordpress plugin for pagination styling. There are multiple pagination plugins available for pagination styling but wp-pagenavi is most popular.

wordpress pagination style without wordpress plugin

I always recommend wordpress theme developers to not to use the wordpress plugins as much possible because any wordpress plugin will install the extra unuseful code also.

wordpress pagination style without wordpress plugin
wordpress pagination style without wordpress plugin

Here in this article I am giving you the example about wordpress pagination without using any wordpress plugin.

Just open your functions.php file and put following code.


function wpapi_pagination($pages = '', $range = 4)
{
 $showitems = ($range * 2)+1;

 global $paged;
 if(empty($paged)) $paged = 1;

 if($pages == '')
 {
 global $wp_query;
 $pages = $wp_query->max_num_pages;
 if(!$pages)
 {
 $pages = 1;
 }
 }

 if(1 != $pages)
 {
 echo "</pre>
<div class="\&quot;wpapi_pagination\&quot;">Page ".$paged." of ".$pages."";
 if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href="&quot;.get_pagenum_link(1).&quot;">« First</a>";
 if($paged > 1 && $showitems < $pages) echo "<a href="&quot;.get_pagenum_link($paged - 1).&quot;">‹ Previous</a>";

 for ($i=1; $i <= $pages; $i++)
 {
 if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
 {
 echo ($paged == $i)? "<span class="\&quot;current\&quot;">".$i."</span>":"<a class="\&quot;inactive\&quot;" href="&quot;.get_pagenum_link($i).&quot;">".$i."</a>";
 }
 }

 if ($paged < $pages && $showitems < $pages) echo "<a href="\&quot;&quot;.get_pagenum_link($paged">Next ›</a>";
 if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "<a href="&quot;.get_pagenum_link($pages).&quot;">Last »</a>";
 echo "</div>
<pre>\n";
 }
}

Above function will give the wordpress pagination style like google search engine.

Then open style.css file from your wordpress theme file and put following code in that file.


.wpapi_pagination {
clear:both;
padding:20px 0;
position:relative;
font-size:11px;
line-height:13px;
}

.wpapi_pagination span, .wpapi_pagination a {
display:block;
float:left;
margin: 2px 2px 2px 0;
padding:6px 9px 5px 9px;
text-decoration:none;
width:auto;
color:#fff;
background: #555;
}

.wpapi_pagination a:hover{
color:#fff;
background: #3279BB;
}

.wpapi_pagination .current{
padding:6px 9px 5px 9px;
background: #3279BB;
color:#fff;
}

Then finally where you want to show the wordpress pagination there in area put following code (index.php, etc..)


if (function_exists("wpapi_pagination")) {
 wpapi_pagination($additional_loop->max_num_pages);

 

wordpress pagination style without wordpress plugin
wordpress pagination style without wordpress plugin

If you are having any issues or question about adding the wordpress pagination without plugin then please write me.