mirror of https://github.com/vtrois/kratos
feat: optimize search tool style
parent
7b4c5622b2
commit
70cf41b294
|
@ -1822,7 +1822,7 @@ button:focus {
|
|||
display: inline-block;
|
||||
margin: 0 1px 10px 0;
|
||||
padding: 2px 0;
|
||||
width: 165px;
|
||||
width: 164px;
|
||||
border: 1px solid #eeeeee;
|
||||
color: #333;
|
||||
list-style: none;
|
||||
|
@ -1834,7 +1834,7 @@ button:focus {
|
|||
display: inline-block;
|
||||
margin: 0 1px 10px 0;
|
||||
padding: 2px 0;
|
||||
width: 165px;
|
||||
width: 164px;
|
||||
color: #333;
|
||||
list-style: none;
|
||||
font-size: 15px;
|
||||
|
@ -1916,26 +1916,20 @@ button:focus {
|
|||
display: none;
|
||||
}
|
||||
|
||||
.searchform input[type="text"] {
|
||||
width: 205px;
|
||||
.btn-search {
|
||||
background-color: #00a2ff;
|
||||
border-color: #00a2ff;
|
||||
}
|
||||
|
||||
.searchform input[type="submit"] {
|
||||
padding: 0.375rem 0.75rem;
|
||||
width: 80px;
|
||||
border: none;
|
||||
border-radius: 3px;
|
||||
background-color: #00a2ff;
|
||||
color: #fff;
|
||||
font-weight: 400;
|
||||
font-size: 14px;
|
||||
line-height: 1.7;
|
||||
transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out,
|
||||
border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
.btn-search:not(:disabled):not(.disabled):active,
|
||||
.btn-search:hover,
|
||||
.btn-search:focus {
|
||||
background-color: #0095ff;
|
||||
border-color: #0095ff;
|
||||
}
|
||||
|
||||
.btn-search:not(:disabled):not(.disabled):active:focus {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.k-main .sidebar .widget_categories ul,
|
||||
|
@ -1950,7 +1944,7 @@ button:focus {
|
|||
overflow: hidden;
|
||||
margin: 0 1px 4px 0;
|
||||
padding: 4px 0;
|
||||
width: 165px;
|
||||
width: 164px;
|
||||
border: 1px solid #eeeeee;
|
||||
list-style: none;
|
||||
text-align: center;
|
||||
|
@ -1968,6 +1962,17 @@ button:focus {
|
|||
color: #333;
|
||||
}
|
||||
|
||||
.k-main .sidebar .w-search .form-control,
|
||||
.k-main .sidebar .w-search .btn {
|
||||
font-size: 15px;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.k-main .sidebar .w-search .btn {
|
||||
padding-left: 25px;
|
||||
padding-right: 25px;
|
||||
}
|
||||
|
||||
@media screen and (max-width: 1310px) {
|
||||
.nav-tabs .nav-link {
|
||||
padding: 8px 22px;
|
||||
|
@ -1978,14 +1983,6 @@ button:focus {
|
|||
width: 110px;
|
||||
}
|
||||
|
||||
.searchform input[type="text"] {
|
||||
width: 160px;
|
||||
}
|
||||
|
||||
.searchform input[type="submit"] {
|
||||
width: 65px;
|
||||
}
|
||||
|
||||
.k-main .sidebar .widget_categories ul li,
|
||||
.k-main .sidebar .widget_archive ul li {
|
||||
width: 110px;
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -3,7 +3,7 @@
|
|||
* 侧栏小工具
|
||||
* @author Seaton Jiang <seaton@vtrois.com>
|
||||
* @license MIT License
|
||||
* @version 2020.04.12
|
||||
* @version 2020.08.03
|
||||
*/
|
||||
|
||||
// 添加小工具
|
||||
|
@ -24,6 +24,7 @@ function widgets_init()
|
|||
'WP_Widget_Recent_Posts',
|
||||
'WP_Widget_Recent_Comments',
|
||||
'WP_Widget_RSS',
|
||||
'WP_Widget_Search',
|
||||
'WP_Widget_Tag_Cloud',
|
||||
'WP_Nav_Menu_Widget',
|
||||
);
|
||||
|
@ -58,6 +59,46 @@ function most_comm_posts($days = 30, $nums = 6)
|
|||
echo $output;
|
||||
}
|
||||
|
||||
class widget_search extends WP_Widget {
|
||||
|
||||
public function __construct() {
|
||||
$widget_ops = array(
|
||||
'classname' => 'widget_search',
|
||||
'description' => __( 'A search form for your site.' ),
|
||||
'customize_selective_refresh' => true,
|
||||
);
|
||||
parent::__construct( 'search', _x( 'Search', 'Search widget' ), $widget_ops );
|
||||
}
|
||||
|
||||
public function widget( $args, $instance ) {
|
||||
$title = ! empty( $instance['title'] ) ? $instance['title'] : '';
|
||||
$title = apply_filters( 'widget_title', $title, $instance, $this->id_base );
|
||||
|
||||
echo '<div class="widget w-search">';
|
||||
if ( $title ) {
|
||||
echo '<div class="title">'. $title .'</div>';
|
||||
}
|
||||
echo '<div class="item"> <form role="search" method="get" id="searchform" class="searchform" action="'. home_url('/') .'"> <div class="input-group mt-2 mb-2"> <input type="text" name="s" id="search" class="form-control" placeholder="'. __('搜点什么呢?', 'kratos') .'"> <div class="input-group-append"> <button class="btn btn-primary btn-search" type="submit" id="searchsubmit">'. __('搜索', 'kratos') .'</button> </div> </div> </form>';
|
||||
echo '</div></div>';
|
||||
}
|
||||
|
||||
public function form( $instance ) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '' ) );
|
||||
$title = $instance['title'];
|
||||
?>
|
||||
<p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function update( $new_instance, $old_instance ) {
|
||||
$instance = $old_instance;
|
||||
$new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '' ) );
|
||||
$instance['title'] = sanitize_text_field( $new_instance['title'] );
|
||||
return $instance;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class widget_ad extends WP_Widget
|
||||
{
|
||||
public function __construct()
|
||||
|
@ -340,6 +381,7 @@ function register_widgets()
|
|||
register_widget('widget_ad');
|
||||
register_widget('widget_about');
|
||||
register_widget('widget_tags');
|
||||
register_widget('widget_search');
|
||||
register_widget('widget_posts');
|
||||
}
|
||||
add_action('widgets_init', 'register_widgets');
|
Loading…
Reference in New Issue