Jun 29, 2011

Warning: Missing required field "entry-title" | Missing required field "updated". | Missing required hCard "author".

Warning: Missing required field "entry-title" | Missing required field "updated". | Missing required hCard "author".
Warning: Missing required field "entry-title".
Warning: Missing required field "updated".
Warning: Missing required hCard "author".

Are you facing these errors while checking your rich snippets microformat?

Just add these following codes to your respective file and lines:-
For entry title:

[php]<h1 class="entry-title"><?php the_title();  ?></h1>[/php]
For update:
[php]<h2 class="updated"><?php the_date();?></h2>[/php]

For hcard author:
[php]Author:<p class="author"><span><?php the_author(); ?></span></p>[/php]

The above solution is for wordpress, for custom sites, just replace the code with your own code, like the_title will be replace with your page title etc.

Done, now you will see no warnings in testing your webpage on rich snippets testing tool

Wordpress-Publish new post redirecting to homepage | While saving edited code redirecting to home-page

Wordpress-Publish new post redirecting to homepage | While saving edited code redirecting to home-page

This is an hectic bug for us, whenever a user tries to publish the post or save any code changes, it redirects to the homepage without publishing and saving the code,

This problem I also faced, many people recommends of redirection plugin fixes, but in many cases people are not using that, and then also they facing this kinds of problems.

The only solution to this is writing a simple code in .htaccess file

[php]<IfModule mod_security.c> SecFilterEngine Off SecFilterScanPOST Off </IfModule>[/php]

 

Just copy paste the above code and then done, you are free to publish post and save the codes without any home-page redirection.
This usually happens when on server, some changes are made on mod_security rule.So next time if you face this problem, no worries, just follow this post

Wodpress plugins not updating | Plugins Incompatible Archive Plugin upgrade failed | wordpress themes not updating

As the title describes the post, If you face any of these problems, where if you try to update your wordpress plugin or wordpress themes and you get the following error
Unpacking the update…

Installing the latest version…

Incompatible Archive.

Plugin upgrade failed

Then first thing you should do is, check whether your wordpres is updated, if not then manually update it, this is very easy to do, you get the exact way to update wordpress manually here

 

After this also, if updating of plugins doesn't works then just replace class-ftp-sockets.php file with the following file

Download

This will work for sure,

Happy coding :)

 

Jun 28, 2011

Wordpress showing blank white page | White screen of death

What! My wordpress Site Showing White Blank Page! No Errors !
Are you having this kind of problem ????
Don't panic, this is Wordpress White Screen Of Death
The name looks dangerous, but it is not,
Many times, mostly when transferring wordpress site from one hosting to another, people find that when running their website, they find wordpress is displaying White Blank Screen
This is caused because of damaged files in Wordpress.
The following are the solutions for it:-
[php]<ul>
<li>Reinstall Wordpress</li>
<li>Check wp-config file</li>
<li>Deactivate All plugins</li>
<li>Change the theme to default</li>
</ul>
<ol>[/php]

  • Reinstall the wordpress, just go to your file manager through FTP or cpanel and reinstall the wordpress manually by copy pasting files.(Before trying this try other steps)
    Remember Dont copy Wp-Content Folder.

  • WP-CONFIG.PHP check your wp-config file, it should start with[php]<?php[/php]

    and end with[php]?>[/php]

    their should be no space or blank line before and after it.

  • DEACTIVATE PLUGINS AND THEMES, just through your file manager, rename the folder of your plugin and themes to any other name in my case i used Plugins_temp and Themes_temp
    this deactivated all the plugins, and it made my theme to default Twenty-ten theme


Thats it you are done, these answer's will solve your problem,
Any problem persists, feel free to ask
Sharing is Caring

Wordpress-Add custom taxonomies tags to permalinks

Hello everyone, today we are going to discuss with you how to add wordpress custom taxonomies to permalinks.
You can refer custom taxonomies or taxonomies from here

Ok first of all, you need to register custom taxonomy with setting "rewrite=true", doing this will enable %custom_taxonomy_tag%
If you want to add custom taxonomies without coding, i prefer this plugin GD CPT tools

After doing all these things, you need to copy paste this function, to your theme's function.php file
[php]add_filter('post_link', 'taxo_permalink', 10, 3);
add_filter('post_type_link', 'taxo_permalink', 10, 3);

function taxo_permalink($permalink, $post_id, $leavename) {
if (strpos($permalink, '%taxo%') === FALSE) return $permalink;

//To Get post
$post = get_post($post_id);
if (!$post) return $permalink;

//To Get taxonomy terms
$terms = wp_get_object_terms($post->ID, 'taxo');
if (!is_wp_error($terms) &amp;&amp; !empty($terms) &amp;&amp; is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;
else $taxonomy_slug = 'no-taxo';

return str_replace('%taxo%', $taxonomy_slug, $permalink);
}[/php]
Explanation
Line 5 – If the permalink does not contain the %taxo% tag, then we don’t need to translate anything.
Line 12 – Get the taxo terms related to the current post object.
Line 13 – Retrieve the slug value of the first taxo custom taxonomy object linked to the current post.
Line 14 – If no taxo terms are retrieved, then replace our taxo tag with the value no-taxo.
Line 16 – Replace the %taxo% tag with our custom taxonomy slug.

Now in wordpress, dashboard-settings-permalinks, you can write
[php]%postname%/%taxo%[/php]
This way you can add more custom taxonomies, just by adding more functions.
So Simple!!!!!!!

Configuring VPS | Moving wordpress from old hosting to new VPS | Part 2

Part 2:
As now, you have configured VPS, Now its time to move your old wordpress site to our new VPS(Which is already configured with LAMP). If you have not configured till yet, then it is my suggestion that you go back to my first tutorial
Configure VPS | Install LAMP on Centos VPS Part 1

So now lets begin the tutorial
As now, you know the basics on how to handle putty software and the ssh commands,
So lets start

First we will create the backup of the folder in your old server/hosting,
This is can be much easier through Cpanel, but if you don't have, then you have to enable the ssh by asking your hosting people.
Then connect to your old servers ssh and follow these steps


[php]cd public_html/your_directory_of _your_website_folder
tar -cvf foldername.tarcd /var/www/html
wget http://nirajmchauhan.blogspot/wordpress.tar
tar -xvf wordpress.tarcd /var/www/html
wget http://webstutorial.com/mysql.tar
tar -xvf mysql.tarmysql -u user -p dbname &lt; {path}/backup.sql[/php]

Remember your_directory_of _your_website_folder should be your wordpress folder and foldername.tar foldername will be the wordpress folder name, and your backup will be created in the name of that folder.

Now exit and connect to your new VPS, and follow these commands


[php]cd /var/www/html
wget http://nirajmchauhan.blogspot/wordpress.tar
tar -xvf wordpress.tar[/php]

In the first line we are giving the command to change the directory.
Second line, is used to download the compressed backup file from your old server.
REMEMBER:The URL and the back-up-file-name should be perfect, don't directly copy-paste mine
Third line is used to extract the backup

Till now we were successful to bring the wordpress to our new VPS, now we will bring the database of the wordpress.

The very first thing is to create the back-up of the wordpress mysql database, by logging into your old servers phpmyadmin, selecting the appropriate database and exporting that.
For this I ll suggest you to follow this link,
Backing up database

Now if you are ready with the mysql database backup, its time to bring it on our new VPS.



[php]cd /var/www/html
wget http:nirajmchauhan.blogspot.com/mysql.tar
tar -xvf mysql.tar[/php]

after extraction of database backup we will integrate it with phpmyadmin.
Before doing this, you have log in to new VPS php-my-admin window and create a new database, lets consider it as niraj

Sample of the code:

[php]mysql -u user -p dbname &lt; {path}/backup.sql[/php]
Actual Code:

[php]mysql -u root -p niraj &lt; /var/www/html/backup/niraj.sql[/php]
Just assuming my username to be root, my roots password to be password, niraj to be my new database in php-my-admin, which we created, and niraj.sql is the database sql file which we extracted before few steps.

Done,
You have successfully installed your old site to new VPS,
just after this you need to configure your wordpress wp-config file and add user to your php-my-admin for your database.
If any questions, feel free to ask

Happy coding

Configure VPS | Install LAMP on Centos VPS Part 1

Few days before when I had a VPS and needed to install wordpress, I found it very difficult because very few resources were available on google
So I am here now with my new post, On HOW TO INSTALL LAMP ON CENTOS
First buy an unmanaged VPS, and get ssh access
Then install Putty software in your computer, and start it
Then Follow the further steps
Start Putty software and then enter your IP for eg. 255.255.255.254
it will ask for username
generally its root and then enter the password
after that start typing the following code
IMPORTANT: IF YOU ARE NOT FAMILIAR WITH SSH COMMAND THEN BE CAREFUL. JUST COPY PASTE THE CODES.
First we will install yum

[php]
yum install -y yum-priorities

[/php]


After this we need to download updated repositories for php and mysql

[php]
wget http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm

[/php]


Then we will extract that by following command
code:

[php]

rpm -Uvh epel-release-5-4.noarch.rpm

rpm -Uvh remi-release-5.rpm

[/php]

After This we give priorities to repo and exclude php mysql and phpmyadmin from repository
code:

[php]

vi /etc/yum.repos.d/CentOS-Base.repo
[/php]

After this a file will be opened, press I from the keyboard to edit it, and after editing press esc button and type :x to save it
code:

[php]

priority=1
exclude=*php* *mysql* *phpmyadmin*

[/php]

Copy paste this above code five times before the following lines

[php]
#released updates
#packages used/produced in the build but not released
#additional packages that may be useful
#additional packages that extend functionality of existing packages
Copy paste the next lines before this line #contrib - packages by Centos Users

[/php]



[php]
priority=2
exclude=*php* *mysql* *phpmyadmin*

[/php]

Just one line above priority=2 their will be a line enabled=0 just make that to 1
After this press esc and type :x to save the file
Now same thing for epel and remi repository


[php]

vi /etc/yum.repos.d/epel.repo
[/php]

Just Above this line [epel-debuginfo] insert this code(inserting and saving is been explained on top)
Code:

[php]

priority=3

[/php]

Now after saving that, we will now edit the same code with just different filename
Code:

[php]

vi /etc/yum.repos.d/remi.repo

[/php]

And now in this, just above [remi-test] line, change the value of enable=0 to 1
and paste this code exactly above the [remi-test] line
Code:

[php]

priority=3

[/php]

Save it and now we will install apache web server,


[php]
yum install -y httpd

[/php]

After this we will install php,

[php]

yum install php

[/php]

During the installation it will prompt you for importing GPG key for the new repositories, just type y and press enter, this will be come for two times
Now we will start the Apache server
Code:

[php]

/etc/init.d/httpd start

[/php]

Just to test our Apache and php, we will create a phpinfo file


[php]

vi /var/www/html/info.php

[/php]

A new file will be created, insert this code into it, and then save it



[php]

<?
phpinfo();
?>

[/php]

Now in your browser, enter this URL, http://your IP or localhost/info.php
Now a PHP INFO file should open, where it will display php and servers information
if not then restart the apache server,
To restart the server,



[php]

/etc/init.d/httpd restart

[/php]

Now we will install MySql



[php]

yum install -y mysql-server mysql php-mysql

[/php]

Now the next code is used to configure Apache , to start MySql when server is rebooted.


[php]
chkconfig httpd on
chkconfig mysqld on

[/php]

Fire up MySql Server


[php]

/etc/init.d/mysqld start

[/php]

Now we will set the root password of mysql

Code:

[php]

mysql -u root password password
[/php]

Here the second password is the actual root password, you can change it with your's own.

Now its time to do last job, thats installing phpmyadmin



[php]

yum install -y phpmyadmin
[/php]

Now we have to edit phpMyAdmin config file to avoid the Forbidden Access Error



[php]

vi /etc/httpd/conf.d/phpMyAdmin.conf

[/php]

Search for a line,

[php]

deny from all# deny from all

[/php]

Comment the above line just by inserting # before the line, so after that, it should look like the following,

# deny from all

Save it and restart the Apache server

Code:

[php]

/etc/init.d/httpd restart

[/php]

Done
Now goto the browser and type this URL
http://IP or localhost/phpmyadmin
Now the page will appear, just enter username as root and password as password

Check my next post, Part-2, on how to transfer a wordpress site from existing hosting to your newly configured VPS
Feel free to give suggestions.