[^<]*?)', '$1' . "{$item->attr_title}<", $item_output); } //remove gallery style add_filter( 'gallery_style', 'my_gallery_style', 99 ); function my_gallery_style() { return "
.
widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) ); } add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' ); ?> 'Main Menu'); foreach($avia_config['nav_menus'] as $key => $value){ register_nav_menu($key, $value); } ?> 'default', 'before_widget' => '$text = str_replace("
", "", $text); $text = str_replace("
", "$text
"; return "$text"; } // Get all image urls from an html document function get_all_img_urls($data) { $images = array(); preg_match_all('/(img|src)\=(\"|\')[^\"\'\>]+/i', $data, $media); unset($data); $data=preg_replace('/(img|src)(\"|\'|\=\"|\=\')(.*)/i',"$3",$media[0]); foreach($data as $url) { $info = pathinfo($url); if (isset($info['extension'])) { if (($info['extension'] == 'jpg') || ($info['extension'] == 'jpeg') || ($info['extension'] == 'gif') || ($info['extension'] == 'png')) array_push($images, $url); } } return $images; } // Get all image urls from an html document function get_all_img_alts($data) { $alts = array(); preg_match_all('/(alt)\=(\"|\')[^\"\'\>]*/i', $data, $media); unset($data); $data=preg_replace('/(alt)(\"|\'|\=\"|\=\')(.*)/i',"$3",$media[0]); foreach($data as $alt) { array_push($alts, $alt); } return $alts; } function get_the_content_with_formatting ($more_link_text = '(more...)', $stripteaser = 0, $more_file = '') { $content = get_the_content($more_link_text, $stripteaser, $more_file); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); return $content; } function strip_single_tags($tags, $string) { foreach( $tags as $tag ) { $string = preg_replace('#?'.$tag.'[^>]*>#is', '', $string); } //remove empty a and p $string = preg_replace('/]*><\\/a[^>]*>/', '', $string); $string = preg_replace('/]*><\\/p[^>]*>/', '', $string); return $string; } /**/ function ux_testimonials($atts, $content = null) { //extract(shortcode_atts(array("id" => '', "no" => ''), $atts)); $id = $atts["id"]; $no = $atts["no"]; $h1 = $atts["h1"]; global $wp_query,$paged,$post; $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query(); if ($no == "") $no = -1; $query = "cat=$id&posts_per_page=$no&orderby=date&order=DESC"; $wp_query->query($query); ob_start(); ?>
$max_width) { $new_width = $max_width; $new_height = ceil(($max_width * $height) / $width); $old_w = 'width="'.$width.'"'; $new_w = 'width="'.$new_width.'"'; $old_h = 'height="'.$height.'"'; $new_h = 'height="'.$new_height.'"'; $html = str_replace($old_w, $new_w, $html); $html = str_replace($old_h, $new_h, $html); } } return $html; } function get_youtube_id($url) { preg_match('#http://w?w?w?.?youtube.com/watch\?v=([A-Za-z0-9\-_]+)#s', $url, $matches); return $matches[1]; } function get_vimeo_id($url) { $matches = parse_url($url); $matches = str_replace("/","",$matches[path]); return $matches; } function get_video_img($url) { preg_match('#http://w?w?w?.?youtube.com/watch\?v=([A-Za-z0-9\-_]+)#s', $url, $matches); $youtube_thumbnail = 'http://img.youtube.com/vi/' . $matches[1] . '/0.jpg'; //preg_match('#http://w?w?w?.?vimeo.com/([A-Za-z0-9\-_]+)#s', $url, $matches); //$vimeo_url = 'http://vimeo.com/api/v2/video/' . $matches[1] . '.php'; return $youtube_thumbnail; } function is_youtube($video_url) { if (strpos($video_url, "youtube.com")) return 1; else return 0; } function is_vimeo($video_url) { if (strpos($video_url, "vimeo.com")) return 1; else return 0; } function is_swf($video_url) { if (strpos($video_url, ".swf")) return 1; else return 0; } function get_image_alt($image, $html_content) { $poc = strpos($html_content, $image); $poc = strpos($html_content, 'alt="', $poc + 1); $kraj = strpos($html_content, '"', $poc + 5); $alt = substr($html_content, $poc + 5, $kraj - $poc - 5); return $alt; } function only_characters($string) { $pattern = '/[^A-Za-z0-9:.\/_-]/'; $clean = preg_replace($pattern,'',$string); return $clean; } function no_comments($no) { if ($no == 0) return "no comments"; if ($no == 1) return "1 comment"; if ($no > 1) return "$no comments"; } // Adds a rel="prettyPhoto" tag to all linked image files add_filter('the_content', 'addlightboxrel_replace', 12); add_filter('get_comment_text', 'addlightboxrel_replace'); add_filter('wp_get_attachment_image', 'addlightboxrel_replace'); function addlightboxrel_replace ($content) { global $post; $pattern = "/]*).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>(.*?)<\/a>/i"; $replacement = '$7'; $content = preg_replace($pattern, $replacement, $content); return $content; } //breadcrumbs function get_breadcrumbs() { global $wp_query; if ( !is_home() ){ // Start the UL echo '"; } } //EDN breadcrumbs add_action('after_setup_theme', 'my_theme_setup'); //muti languages function my_theme_setup(){ load_theme_textdomain('ux', get_template_directory() . '/languages'); } //add image for slide function attachment_url_extra( $form_fields, $post ) { $post->post_type == 'attachment'; //Brick Color form $form_fields[ 'brick_color' ] = array( 'label' => __( 'Block Color','ux' ), 'input' => 'text', 'value' => get_post_meta( $post->ID, '_brick_color', true ) ); $form_fields[ 'brick_color' ][ 'label' ] = __( 'Block Color','ux' ); $form_fields[ 'brick_color' ][ 'input' ] = "html"; $form_fields[ 'brick_color' ][ 'html' ] = "Block Color for Brick slide
"; //link form $form_fields[ 'link_to' ] = array( 'label' => __( 'Slide Link','ux' ), 'input' => 'text', 'value' => get_post_meta( $post->ID, '_link_to', true ) ); $form_fields[ 'link_to' ][ 'label' ] = __( 'Slide Link','ux' ); $form_fields[ 'link_to' ][ 'input' ] = 'html'; $form_fields[ 'link_to' ][ 'html' ] = "Enter a link URL for slide
"; return $form_fields; } add_filter( 'attachment_fields_to_edit', 'attachment_url_extra', NULL, 2 ); function attachment_url_extra_save( $post, $attachment ) { if( isset( $attachment[ 'brick_color' ] ) ) { if( trim( $attachment[ 'brick_color'] ) == '' ) $post[ 'errors' ][ 'brick_color' ][ 'errors' ][] = __( 'Error! Something went wrong.','ux' ); else update_post_meta( $post[ 'ID' ], '_brick_color', $attachment[ 'brick_color' ] ); } if( isset( $attachment[ 'link_to' ] ) ) { if( trim( $attachment[ 'link_to'] ) == '' ) $post[ 'errors' ][ 'link_to' ][ 'errors' ][] = __( 'Error! Something went wrong.','ux' ); else update_post_meta( $post[ 'ID' ], '_link_to', $attachment[ 'link_to' ] ); } return $post; } add_filter( 'attachment_fields_to_save', 'attachment_url_extra_save', NULL, 2 ); //load out function require_once locate_template('/functions/custom_fields.php'); /* Register frontend javascripts: */ function ux_frontend_js(){ wp_register_script( 'ux-default', UX_LOCAL_URL.'/js/main.js', 'jquery', "1.6.4", true); wp_register_script( 'ux-prettyPhoto', UX_LOCAL_URL.'/js/prettyPhoto.js', 'jquery', "3.1.3", true); wp_register_script( 'ux-isotope', UX_LOCAL_URL.'/js/jquery.isotope.js', 'jquery', "1.5.1", true); wp_register_script( 'ux-flexslider', UX_LOCAL_URL.'/js/jquery.flexslider.js', 'jquery', "1.1.0", true); wp_register_script( 'ux-infinitescroll', UX_LOCAL_URL.'/js/jquery.infinitescroll.min.js', 'jquery', "2.0", true); wp_register_script( 'ux-nivoslider', UX_LOCAL_URL.'/js/jquery.nivo.slider.pack.js', 'jquery', "2.7.1", true); wp_register_script( 'ux-map-load-ggserver', 'http://maps.google.com/maps/api/js?sensor=false', 'jquery', "1", true); wp_register_script( 'ux-jqueryuimap', UX_LOCAL_URL.'/js/jquery.ui.map.js', 'jquery', "1", true); wp_register_script( 'ux-googlefont', UX_LOCAL_URL.'/js/googlefont.js.php', 'jquery', "1.6.4", true); if (!is_admin()) { wp_enqueue_script( 'jquery' ); wp_enqueue_script( 'ux-isotope' ); wp_enqueue_script( 'ux-infinitescroll' ); wp_enqueue_script( 'ux-nivoslider' ); wp_enqueue_script( 'ux-flexslider' ); wp_enqueue_script( 'ux-prettyPhoto' ); wp_enqueue_script( 'ux-map-load-ggserver' ); wp_enqueue_script( 'ux-jqueryuimap' ); wp_enqueue_script( 'ux-default' ); if ( is_singular() ) { wp_enqueue_script( "comment-reply" ); } wp_enqueue_script( 'ux-googlefont' ); } } add_action('wp_enqueue_scripts', 'ux_frontend_js'); function ux_frontend_styles() { wp_register_style('flexslider-css', UX_LOCAL_URL . '/styles/flexslider.css', array(), '1.8', 'screen'); wp_register_style('reset-css', UX_LOCAL_URL . '/styles/reset.css', array(), '1.6.4', 'screen'); wp_register_style('color-stateblue-css', UX_LOCAL_URL . '/styles/color-stateblue.css', array(), '1.6.4', 'screen'); wp_register_style('color-sienna-css', UX_LOCAL_URL . '/styles/color-sienna.css', array(), '1.6.4', 'screen'); wp_register_style('color-peru-css', UX_LOCAL_URL . '/styles/color-peru.css', array(), '1.6.4', 'screen'); wp_register_style('color-orange-css', UX_LOCAL_URL . '/styles/color-orange.css', array(), '1.6.4', 'screen'); wp_register_style('color-mediumpurple-css', UX_LOCAL_URL . '/styles/color-mediumpurple.css', array(), '1.6.4', 'screen'); wp_register_style('color-grey-css', UX_LOCAL_URL . '/styles/color-grey.css', array(), '1.6.4', 'screen'); wp_register_style('color-green-css', UX_LOCAL_URL . '/styles/color-green.css', array(), '1.6.4', 'screen'); wp_register_style('color-dodgerblue-css', UX_LOCAL_URL . '/styles/color-dodgerblue.css', array(), '1.6.4', 'screen'); wp_register_style('color-blue-css', UX_LOCAL_URL . '/styles/color-blue.css', array(), '1.6.4', 'screen'); wp_register_style('color-deeppink-css', UX_LOCAL_URL . '/styles/color-deeppink.css', array(), '1.6.4', 'screen'); wp_register_style('dark-css', UX_LOCAL_URL . '/styles/dark.css', array(), '1.6.4', 'screen'); wp_register_style('light-css', UX_LOCAL_URL . '/styles/light.css', array(), '1.6.4', 'screen'); wp_register_style('style-css', UX_LOCAL_URL . '/styles/style.css', array(), '1.6.4', 'screen'); wp_register_style('skeleton-css', UX_LOCAL_URL . '/styles/skeleton.css', array(), '1.6.4', 'screen'); wp_register_style('prettyPhoto-css', UX_LOCAL_URL . '/styles/prettyPhoto.css', array(), '3.1.3', 'screen'); wp_register_style('customstyle-css', UX_LOCAL_URL . '/styles/custom-css.css.php', array(), '1.6.4', 'screen'); wp_enqueue_style('flexslider-css'); wp_enqueue_style('reset-css'); wp_enqueue_style('style-css'); wp_enqueue_style('flexslider-css'); wp_enqueue_style('skeleton-css'); wp_enqueue_style('prettyPhoto-css'); wp_enqueue_style('customstyle-css'); } add_action('wp_enqueue_scripts', 'ux_frontend_styles'); ?>