/** * The geodirectory popular post category shortcode. * * This implements the functionality of the shortcode for displaying popular post category. * * @since 1.0.0 * @since 1.5.1 Added default_post_type parameter. * @package GeoDirectory * @global string $geodir_post_category_str The geodirectory post category. * @param array $atts { * Attributes of the shortcode. * * @type string $before_widget HTML content to prepend to each widget's HTML output. Default. Empty. * @type string $after_widget HTML content to append to each widget's HTML output. Default. Empty. * @type string $before_title HTML content to prepend to the title when displayed. Default. Empty. * @type string $after_title HTML content to append to the title when displayed. Default. Empty. * @type int $category_limit Number of categories to display. Default. 15. * @type string $title Widget title. Default. Empty. * @type string $default_post_type Default post type. Default. Empty. * * } * @return string Popular post category HTML. */ function geodir_sc_popular_post_category($atts) { ob_start(); global $geodir_post_category_str; $defaults = array('category_limit' => 15, 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', 'title' => '', 'default_post_type' => ''); $params = shortcode_atts($defaults, $atts, 'popular_post_category'); $params['category_limit'] = absint($params['category_limit']); $params['default_post_type'] = gdsc_is_post_type_valid($params['default_post_type']) ? $params['default_post_type'] : ''; geodir_popular_post_category_output($params, $params); $output = ob_get_contents(); ob_end_clean(); return $output; }
/** * Front-end display content for popular post category widget. * * @since 1.0.0 * @since 1.5.1 Declare function public. * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget($args, $instance) { geodir_popular_post_category_output($args, $instance); }