Categorized | WordPress

Bul widget’in geliştirilmesi

Posted on 06 August 2008

wordpress de fark ettiğim arama kutusunun kenarlığının olmadığı ve adının değiştirilemediğidir. Bunu düzenlemek için yapılacak sadece bir kaç editleme var.

wp-inludes/widgets.php dosyasını açalım;

Bu kodu bulun;

[php]function wp_widget_search($args) {
extract($args);
$searchform_template = get_template_directory() . ‘/searchform.php’;

echo $before_widget;

// Use current theme search form if it exists
if ( file_exists($searchform_template) ) {
include_once($searchform_template);
} else { ?>

echo $after_widget;
}
[/php]

Bununla değiştirin:

[php]function wp_widget_search($args) {
extract($args);
$searchform_template = get_template_directory() . ‘/searchform.php’;
$options = get_option(’widget_search’);
$title = apply_filters(’widget_title’, $options['title']);
if ( empty($title) )
$title = ‘ ’;
echo $before_widget . $before_title . $title . $after_title;
echo ‘

‘;// Use current theme search form if it exists
if ( file_exists($searchform_template) ) {
include_once($searchform_template);
} else { ?>

echo ‘

‘;
echo $after_widget;
}

function wp_widget_search_control() {
$options = $newoptions = get_option(’widget_search’);
if ( $_POST["search-submit"] ) {
$newoptions['title'] = strip_tags(stripslashes($_POST["search-title"]));
}
if ( $options != $newoptions ) {
$options = $newoptions;
update_option(’widget_search’, $options);
}
$title = attribute_escape($options['title']);
?>

}
[/php]

Bu kodu bulun:

[php] wp_register_sidebar_widget(’search’, __(’Search’), ‘wp_widget_search’, $widget_ops);
[/php]

Altına bunu ekleyin :

[php] wp_register_widget_control(’search’, __(’Search’), ‘wp_widget_search_control’ );
[/php]

Hepsi bu kadar, şimdi nasıl göründüğüne bakalım.

This post was written by:

admin - who has written 13 posts on bahadir.biz.


Contact the author

Leave a Reply

You must be logged in to post a comment.