Showing posts with label Wordpress. Show all posts
Showing posts with label Wordpress. Show all posts

Wednesday, 1 June 2011

HTTP Error occurred during the API request : WordPress


Stepwise instructions to resolve the HTTP error “An Unexpected HTTP Error occured during the API request” which occurs due to the fixed timeout set by WordPress.
The error pops up when the WordPress Server takes too much time while fetching information, this HTTP error message occurs while you are trying to install WordPress plugins and themes

To resolve  “An Unexpected HTTP Error occurred during the API request” Error message,
Follow these simple steps
  1. Connect your FTP and go to Public_html folder (Where wordpress is installed)
  2. Open wp_include/class-http.php file
  3. Look out for the 220th line or search for “http_request_timeout”
  4. You can find this line: ‘timeout’ => apply_filters( ‘http_request_timeout’, 5),
  5. Now change the  value “5” to “30” and save the file and upload. (this value indicates the no. of seconds before the server times out).
  6. Finally this HTTP Error resolved

How to Get Google Add middle of the post : Wordpress


How to Get Google Add middle of the post : Wordpress
Here i would like share how to put Adsense code or any other ads code inside the WordPress post content


  1. Go to Appearance –> Editor and select functions.php
  2. Copy and past the following code in functions.php and save it
function inject_ad_text_after_n_chars($content) {
  // only do this if post is longer than 1000 characters
  $enable_length = 1000;
  // insert after the first </p> after 500 characters
  $after_character = 500;
  if (is_single() && strlen($content) > $enable_length) {
    $before_content = substr($content, 0, $after_character);
    $after_content = substr($content, $after_character);
    $after_content = explode('</p>', $after_content);
    $text = '
      <!-- PUT YOUR AD HERE -->
    ';
    array_splice($after_content, 1, 0, $text);
    $after_content = implode('</p>', $after_content);
    return $before_content . $after_content;
  }
  else {
    return $content;
  }
}
add_filter('the_content', 'inject_ad_text_after_n_chars');
3.After adding the above code replace <!– PUT YOUR AD HERE –> with your adsense or any advertisement code.

If you Like the post , Please dare to write comments..

Friday, 27 May 2011

How Install Wordpress In Website.




How to install wordpress in your website.

* Word press is CMS technology. CMS means Content Management system.
* Well coming to the point. Download the wordpress from wordpress. org.
* After that login to your Cpanel. (You will get the Cpanel details from your webhosting services.)
* After logging to your Cpanel, you can find the Msql option. We need to create an Msql database.
* Give the Msql database name and as well as password as your wish. Then click on create database button.
* After creating the Msql databse you will get below 4 values.
$msql_host=? Value ?
$msql_database=? Value ?
$msql_user=? Value ?
$msql+password=? Value ?
Copy these values into notepad.
* After This Extract the wordpress which you downloaded from the wordpress. org. Open the extracted folder.
* In that folder you can find the WP-Config-Sample.php file.
* The other thing you need to do while installing the wordpress is open the Wp-Config_sample.php file with notepad and then find the below statements.
define ('DB_NAME', 'database_name_here');
define ('DB_USER', 'username_here');
define ('DB_PASSWORD', 'Paasword_here');
define ('DB_HOST', 'Localhost');
define ('DB_CHARSET', 'UTF8');
define ('DB_COLLATE', '');

* Then replace the database name, database username, database password and Msql host name with your Msql datqabase values which you copied to notepad just now.
* And now save the file with wp-config.php.
* Here we are using Filezill to upload the wordpress in website. Download the software and install in your system.
* Now open your Cpanel again and VIEW FTP option and copy those details and execute those values in File zilla.
* Then create a directory and upload your wordpress files into that directory. And give the username and password to your wordpress. Then open your site and you can find a sample template of your site.