Pages

Tuesday, August 26, 2014

How to disable hyper links in comments section of Wordpress?

To disable hyper links in comment section of Wordpress need to follow below two steps.

1. Open functions.php in the theme which you are using.
2. Place the below code in functions.php and save it.

add_filter('comment_text', 'wp_filter_nohtml_kses');
add_filter('comment_text_rss', 'wp_filter_nohtml_kses');
add_filter('comment_excerpt', 'wp_filter_nohtml_kses');

Monday, July 7, 2014

How to add a Custom Widget in Wordpress?

To add a custom widget just create a plugin by following below steps.

1. Create a folder in plugins folder.
2. Add a php file with folder name(Suppose if folder name is abc the file in folder should abc.php).
3. Add below code in that file.

<?php
/*
Plugin Name: Widget Plugin Name
Plugin URI: Author Link
Description: A simple plugin that adds a calendar of events at rights side
Version: 1.0
Author: Author Name
Author URI: Author Link
License: GPL2
*/
class wp_my_plugin extends WP_Widget {

// constructor
    function wp_my_plugin() {
        parent::WP_Widget(false, $name = __('My Widget', 'wp_widget_plugin') );
    }
    // widget form creation
function form($instance) {

// Check values
if( $instance) {
     $title = esc_attr($instance['title']);
 } else {
     $title = '';
  }
?>

<p>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Widget Title', 'wp_widget_plugin'); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
</p>


 <?php
}

// update widget
function update($new_instance, $old_instance) {
      $instance = $old_instance;
      // Fields
      $instance['title'] = strip_tags($new_instance['title']);
      $instance['text'] = strip_tags($new_instance['text']);
      $instance['textarea'] = strip_tags($new_instance['textarea']);
     return $instance;
}
// display widget
function widget($args, $instance) {
   extract( $args );
   // these are the widget options
   $title = apply_filters('widget_title', $instance['title']);
   $text = $instance['text'];
   $textarea = $instance['textarea'];
   echo $before_widget;
   // Display the widget
   echo '<div class="widget-text wp_widget_plugin_box">';

   // Check if title is set
   if ( $title ) {
      echo $before_title . $title . $after_title;
   }

//add functionality you want add here..
   echo '</div>';
   echo $after_widget;
}
}

// register widget
add_action('widgets_init', create_function('', 'return register_widget("wp_my_plugin");'));
?>

Wednesday, May 14, 2014

How to solve the permalinks issue of /index.php/%postname% but not with just %postname% in IIS?

When we deploy the wordpress in ISS servers or Amazon windows servers .htaccess won't work untill we install httpd.conf and enable the htaccess there. Because of this we will get the issue of url with index.php/%postname% .

To solve this issue go to web.config file in IIS add below code in between of <rewrite><.rewrite>.

<rules>
<rule name="WordPress Rule" stopProcessing="true">
<match url=".*" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php?page_id={R:0}" />
</rule>
</rules>




Tuesday, April 22, 2014

How to Solve White Screen Death problem in wordpress?

To solve the issue we need to first find out where is the problem. For this add the below code in wp-config.php file.

error_reporting(E_ALL);
ini_set('display_errors', 1);

By this you will easily find where is the code error and do the necessary changes and problem maximum get resolves.

How to solve Fatal error: Internal Zend error - Missing class information for in /server/mywebsite/wp-content/plugins/wp-super-cache/wp-cache-base.php on line 5 in wordpress?

To Solve this, just comment the below code in wp-cache-base.php file.

/*if (!class_exists('CacheMeta')) {
    class CacheMeta {
        var $dynamic = false;
        var $headers = array();
        var $uri = '';
        var $post = 0;
    }
}*/

Wednesday, April 2, 2014

How to solve 404 (Page Not Found) Error in wordpress when i moved the code to windows server?

To solve this, need to follow below steps.

1. Change the .htaccess file as per the code folder path..


# BEGIN WordPress
<IfModule mod_rewrite.so>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

2. If its not worked create a web.config file copy the below code and upload into root folder of the project.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
            <rule name="wordpress" patternSyntax="Wildcard">
                <match url="*"/>
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                    </conditions>
                <action type="Rewrite" url="index.php"/>
            </rule></rules>
    </rewrite>
  </system.webServer>
</configuration>

Monday, February 3, 2014

how to solve AJAX HTTP error 200, when try to manage field display & Views?

This problem usually we face in 3 scenarios for drupal
1. when we update Jquery Update to new version. This scenario we can easily solve it by reverting back to old version.And be cautious, while doing any updates in drupal, try to do it in test environment later try in rela time.
2. When we try to fulfill our requirement by hard coding like adding .js files manually instead of using modules. To solve this, our first step is we need to find by which file adding we are getting this error.So try to remove each js file which you added manually and test at admin side still problem persists or not?(Don't forget to remove cache for each trial). Continue this until problem  solved.
3. Sometimes when we install some new modules also we face this problem, because sometimes the js files which are used in new module may be not adjusted to old module js files. So uninstall newly added module and check again.


Friday, January 24, 2014

how to solve blank pages or "white screen of death" (WSOD) in drupal?

This issue will come generally because of allocation of memory in mysql, to over come this just run the below query in mysql server.

mysql> SET max_allowed_packet = 1024 * 1024 * 512;
 
or
 
mysql> SET global max_allowed_packet=1024 * 1024 * 512;