How to change wordpress theme without wordpress admin panel ?

 

There are situations you can’t login into wordpress admin panel to change the wordpress theme.

You can do the following procedure to change it without login into wordpress admin.

1. Login using FTP and change the rename the theme name to temporary. Next time wordpress will revert back to default theme.

2. Change it directly from databse. To do that Enter into PhpMyAdmin or MySQL Console and execute below query,


UPDATE wp_options SET option_value = 'default' WHERE option_name = 'template';
UPDATE wp_options SET option_value = 'default' WHERE option_name = 'stylesheet';
UPDATE wp_options SET option_value = 'default' WHERE option_name = 'current_theme';

To Check the current active theme name you can also execute this before updating it to default theme ,


SELECT *
FROM wp_options
WHERE option_name = 'template'
OR option_name = 'stylesheet'
OR option_name = 'current_theme';

 

( Be sure that theme folder contains the default wordpress themes comes with the installations ( TweentyEleven & TwentyTen until Version 3.0 ).

Wordpress “comment_class” filter

Filters :

comment_class :

Calls when comments are displayed in a post, it is called for generating the css classes for the comment block.

You can add your css class with them to highlight a comment or do any customization you want.

How to use :

Register the filter :

add_filter('comment_class', "test_function", 1 );

Define The Function :

function test_function($classes)
{
     classes[] = "my-css-class";
     return $classes;
}