%s

", $text); } $grouporderby = get_group_orderby(); $output .= awpcp_display_ads($where,$byl='',$hidepager='',$grouporderby,$adorcat='cat'); return $output; } public function shortcode($attrs) { global $wpdb; extract(shortcode_atts(array('id' => 0, 'children' => true), $attrs)); $category = $id > 0 ? AWPCP_Category::find_by_id($id) : null; $children = awpcp_parse_bool($children); if (is_null($category)) return __('Category ID must be valid for Ads to display.', 'category shortcode', 'AWPCP'); if ($children) { // show children categories and disable possible sidebar (Region Control sidelist) $before = awpcp_display_the_classifieds_category('', $category->id, false); } else { $before = ''; } if ($children) $where = '( ad_category_id=%1$d OR ad_category_parent_id = %1$d ) AND disabled = 0'; else $where = 'ad_category_id=%1$d AND disabled = 0'; $where = $wpdb->prepare($where, $category->id); $order = get_group_orderby(); // required so awpcp_display_ads shows the name of the current category $_REQUEST['category_id'] = $category->id; return awpcp_display_ads($where, '', '', $order, 'cat', $before); } }