function widget($args, $instance) { extract($args); $title = apply_filters('widget_name', $instance['title']); $limit = $instance['limit']; $cat = $instance['cat']; $orderby = $instance['orderby']; $more = $instance['more']; $link = $instance['link']; $img = $instance['img']; $mo = ''; $style = ''; if ($more != '' && $link != '') { $mo = '<a class="btn" target="_blank" href="' . $link . '">' . $more . '</a>'; } if (!$img) { $style = ' class="nopic"'; } echo $before_widget; echo $before_title . $mo . $title . $after_title; echo '<ul' . $style . '>'; echo dtheme_posts_list($orderby, $limit, $cat, $img); echo '</ul>'; echo $after_widget; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_name', $instance['title']); $limit = $instance['limit']; $cat = $instance['cat']; $mo = '<a title="点我试一试?" class="fa fa-refresh" href="javascript:;" onclick="get_rand_post(\'' . $instance['limit'] . '\',\'' . $instance['cat'] . '\',\'' . admin_url('admin-ajax.php') . '\');"></a>'; echo $before_widget; echo $before_title . $title . $mo . $after_title; echo '<div class="aside_main"><ul class="post_random">'; echo dtheme_posts_list($limit, $cat); echo '</ul></div>'; echo $after_widget; }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_name', $instance['title']); $limit = $instance['limit']; $cat = $instance['cat']; $orderby = $instance['orderby']; $img = $instance['img']; $style = ''; if (!$img) { $style = ' class="nopic"'; } echo $before_widget; echo $before_title . $title . $after_title; echo '<ul' . $style . '>'; echo dtheme_posts_list($orderby, $limit, $cat, $img); echo '</ul>'; echo $after_widget; }