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:
1 parent
53bdd632d0
commit
93833ad381
13 files changed
+115
-12
No files matched your search
@@ -30,6 +30,13 @@ class WidgetTextTitle extends \WP_Widget {
|
||||
$title = trim((string) ($instance['title'] ?? ''));
|
||||
$desc = trim((string) ($instance['desc'] ?? ''));
|
||||
if ($title === '' && $desc === '') {
|
||||
if (current_user_can('manage_options')) {
|
||||
echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
echo function_exists('aksrt_get_widget_null')
|
||||
? aksrt_get_widget_null(__('请填写标题或描述', 'aksrt')) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
: '<p class="widget-empty">' . esc_html__('请填写标题或描述', 'aksrt') . '</p>';
|
||||
echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -101,7 +108,9 @@ class WidgetTextTitle extends \WP_Widget {
|
||||
}
|
||||
}
|
||||
|
||||
echo '<div class="aksrt-text-title text-title align-' . esc_attr($align) . '" style="' . esc_attr($style) . '">';
|
||||
$in_affix = !empty($instance['in_affix']);
|
||||
$box = 'aksrt-text-title text-title align-' . esc_attr($align) . ($in_affix ? ' is-affix' : '');
|
||||
echo '<div class="' . esc_attr($box) . '" style="' . esc_attr($style) . '"' . ($in_affix ? ' data-affix="true"' : '') . '>';
|
||||
if ($title_html !== '') {
|
||||
echo '<div class="aksrt-text-title__main">' . $title_html . '</div>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||
}
|
||||
@@ -173,6 +182,9 @@ class WidgetTextTitle extends \WP_Widget {
|
||||
<input class="widefat" type="text" name="<?php echo esc_attr($this->get_field_name('desc_color')); ?>" value="<?php echo esc_attr((string) ($instance['desc_color'] ?? '')); ?>">
|
||||
</label>
|
||||
</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