0, 'lng' => 0, 'address' => '', 'zoom' => 15, 'title' => '', 'width' => '100%', 'height' => '200px' ), $atts)); $html = '
3, 'img' => 'on', 'excerpt' => 'off', 'category' => '', 'default_img' => false, 'offset' => 0, ), $atts)); $args = array( 'numberposts' => $num, 'offset' => $offset, 'suppress_filters' => false ); if(!empty($category)){ if(is_numeric($category)){ $args['category'] = $category; } else $args['category_name'] = $category; } $posts = get_posts($args); $class = 'wpmega-postlist'; if($img == 'on') $class.= ' wpmega-postlist-w-img'; $html= ''; return $html; } add_shortcode('wpmega-recent-posts', 'ubermenu_recent_posts'); //legacy add_shortcode('ubermenu-recent-posts', 'ubermenu_recent_posts'); /* * Column Group Shortcode - must wrap [wpmega-col] shortcode */ function ubermenu_colgroup($atts, $data){ $col_index = 0; $pattern = get_shortcode_regex(); $pat = '/\[ubermenu\-col(?.*?)\]'.'(?.*?)'.'\[\/ubermenu\-col\]/s'; //trailing /s makes dot (.) match newlines preg_match_all($pat, $data, $matches, PREG_SET_ORDER); if( empty( $matches ) ){ $pat = '/\[wpmega\-col(?.*?)\]'.'(?.*?)'.'\[\/wpmega\-col\]/s'; //trailing /s makes dot (.) match newlines preg_match_all($pat, $data, $matches, PREG_SET_ORDER); } $columns = array(); foreach($matches as $m){ //get the colspan $colspan_pat = '/colspan="(?[\d]*?)"/'; preg_match($colspan_pat, $m['atts'], $match); $colspan = isset($match['colspan']) ? $match['colspan'] : 1; $col_index += $colspan; //increment by colspan, so if we have 2 cols in a 2/3rds format it's a 3-col with a 2-span and a 1-span $columns[] = '[ubermenu-col '.$m['atts'].' col_index="'.$col_index.'" ]'.$m['data'].'[/ubermenu-col]'; } $html ='
'; foreach($columns as $c){ $html.= do_shortcode($c); } $html.= '
'; return $html; } add_shortcode( 'wpmega-colgroup', 'ubermenu_colgroup'); //legacy add_shortcode( 'ubermenu-colgroup', 'ubermenu_colgroup'); /* * Column Shortcode */ function ubermenu_col($atts, $data){ extract(shortcode_atts(array( 'colspan' => 1, 'col_index' => 0, ), $atts)); $col_index; $data = do_shortcode($data); $data = wpmega_trim_tag($data, array('br', 'br/', 'br /')); return '
'.$data.'
'; } add_shortcode( 'wpmega-col', 'ubermenu_col' ); //legacy add_shortcode( 'ubermenu-col', 'ubermenu_col' ); /** this allows shortcodes in widgets **/ add_filter('widget_text', 'do_shortcode'); /* Tag Trimming Helper Function */ function wpmega_trim_tag($s, $tags){ $s = trim($s); foreach($tags as $tag){ $tag = '<'.$tag.'>'; if(strpos($s, $tag) === 0){ $s = substr($s, strlen($tag)); } if(strpos($s, $tag) === strlen($s) - strlen($tag)){ $s = substr($s, 0, strlen($s) - strlen($tag)); } } return $s; } function ubermenu_searchform(){ $form = ''; return $form; //get_search_form( false ); } add_shortcode('ubermenu-search', 'ubermenu_searchform'); /*function wpmega_filter_search_val($form){ $form = str_replace('value="Search"', 'value="→"', $form); return $form; } add_filter('get_search_form', 'wpmega_filter_search_val');*/