feat(widgets): zibll-like in_affix sticky option across side modules
Add sidebar affix (data-affix) to ranking, user/author cards, main/hot/ paid/forum lists, comments, tag cloud, categories and text title with shared sticky CSS.
This commit is contained in:
@@ -169,7 +169,14 @@ class RecentCommentsWidget extends \WP_Widget {
|
||||
if ($title !== '') {
|
||||
echo $args['before_title'] . esc_html($title) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
$in_affix = !empty($instance['in_affix']);
|
||||
if ($in_affix) {
|
||||
echo '<div class="is-affix" data-affix="true">';
|
||||
}
|
||||
echo self::render_html($instance); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
if ($in_affix) {
|
||||
echo '</div>';
|
||||
}
|
||||
echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
|
||||
@@ -202,6 +209,9 @@ class RecentCommentsWidget extends \WP_Widget {
|
||||
</label>
|
||||
<small><?php esc_html_e('填数字 ID 时按作者排除;填文字时按内容关键词排除(兼容旧配置)。', 'aksrt'); ?></small>
|
||||
</p>
|
||||
<p>
|
||||
<label><input type="checkbox" name="<?php echo esc_attr($this->get_field_name('in_affix')); ?>" value="1" <?php checked(!empty($instance['in_affix'])); ?>> <?php esc_html_e('侧栏随动', 'aksrt'); ?></label>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user