public function widget($args, $instance) { if (!isset($instance['jarchive_title'])) { $instance['jarchive_title'] = __('jalali archive', 'ztjalali'); } if (!isset($instance['jarchive_type'])) { $instance['jarchive_type'] = 'monthly'; } if (!isset($instance['jarchive_link_count'])) { $instance['jarchive_link_count'] = 12; } if (!isset($instance['jarchive_show_post_count'])) { $instance['jarchive_show_post_count'] = TRUE; } if (!isset($instance['jarchive_dropdown'])) { $instance['jarchive_dropdown'] = FALSE; } extract($args); echo $before_widget; echo $before_title . $instance['jarchive_title'] . $after_title; if ($instance['jarchive_dropdown']) { echo "<select name=\"jarchive-dropdown\" onchange='document.location.href=this.options[this.selectedIndex].value;'> <option value=\"\">" . esc_attr($instance['jarchive_title']) . "</option>"; ztjalali_archive_widget($instance['jarchive_type'], 'option', $instance['jarchive_show_post_count'], $instance['jarchive_link_count']); echo "</select>"; } else { echo '<ul>'; ztjalali_archive_widget($instance['jarchive_type'], 'html', $instance['jarchive_show_post_count'], $instance['jarchive_link_count']); echo '</ul>'; } echo $after_widget; }
/** * use <b>ztjalali_archive_widget()</b> instead wp_get_jarchives() * @deprecated since 5.0.0 */ function wp_get_jarchives($args = '') { parse_str($args, $r); if (!isset($r['type'])) { $r['type'] = ''; } if (!isset($r['limit'])) { $r['limit'] = ''; } if (!isset($r['format'])) { $r['format'] = 'html'; } if (!isset($r['before'])) { $r['before'] = ''; } if (!isset($r['after'])) { $r['after'] = ''; } if (!isset($r['show_post_count'])) { $r['show_post_count'] = false; } return ztjalali_archive_widget($r['type'], $r['format'], $r['show_post_count'], $r['limit'], $r['before'], $r['after']); }