TODO: To change the footer's content go to Dr.Explain menu Options : Project Settings : HTML (CHM) Export : Setup HTML Template and Layout
Tùy biến hiển thị widget
Hiển thị widgets cho từng trang trong wordpress:
Bạn đã biết cách tùy biến sidebar hiển thị widgets trong template wordpress. Đa phần nhiều website có thiết kế cố định các mục widgets ở sidebar và sử dụng một sidebar duy nhất. Nhưng nếu bạn muốn hiển thị các sidebar widgets khác nhau trong từng trang cụ thể thì làm thế nào?
Hiển thị widget chỉ định vào sidebar:
Tạo hàm kiểm tra sự cho phép hiển thị widget ở sidebar nào.
function jml_sidebar_has_widget( $widget_id, $sidebar ) {
$sidebars = get_option( 'sidebars_widgets' );
if ( ! array_key_exists( $sidebar, $sidebars ) )
return false;
if ( ! in_array( $widget_id, $sidebars["$sidebar"] ) )
return false;
return true;
}
Kiểm tra nếu widget có đặt vào đúng sidebar không.
/**
* Display the widget
*
* @param array $args Widget display arguments including
* before_title, after_title, before_widget, and
* after_widget.
*
* @param array $instance The settings instance of the widget