在Wordpress小部件页面上,您可以看到当您在侧边栏中单击/切换它们时,某些小部件的宽度会增加。我怎么能用我自己的小部件做到这一点?我正在使用WP_Widget类。
谢谢!
答案 0 :(得分:1)
注册窗口小部件时,您可以设置窗口小部件控件选项,以便控制宽度。
检查以下示例代码:
<?php
class WP_Widget_Text_Link extends WP_Widget {
function WP_Widget_Text_Link() {
$widget_ops = array('classname' => 'widget_text', 'description' => __('Arbitrary text or HTML with Title linked'));
$control_ops = array('width' => 600, 'height' => 350);
$this->WP_Widget('textlink', __('Text with Link'), $widget_ops, $control_ops);
}
// stripped down remaining code for the widget, which are not needed for the answer.
}