array( 'name' => 'facebook_username', 'link' => 'http://www.facebook.com/*', ), 'flickr' => array( 'name' => 'flickr_username', 'link' => 'http://www.flickr.com/photos/*' ), 'gplus' => array( 'name' => 'googleplus_username', 'link' => 'https://plus.google.com/u/0/*' ), 'twitter' => array( 'name' => 'twitter_username', 'link' => 'http://twitter.com/*', ), 'instagram' => array( 'name' => 'instagram_username', 'link' => 'http://instagram.com/*', ), 'pinterest' => array( 'name' => 'pinterest_username', 'link' => 'http://pinterest.com/*', ), 'skype' => array( 'name' => 'skype_username', 'link' => 'skype:*' ), 'vimeo' => array( 'name' => 'vimeo_username', 'link' => 'http://vimeo.com/*', ), 'youtube' => array( 'name' => 'youtube_username', 'link' => 'http://www.youtube.com/user/*', ), 'dribbble' => array( 'name' => 'dribbble_username', 'link' => 'http://dribbble.com/*', ), 'linkedin' => array( 'name' => 'linkedin_username', 'link' => '*' ), 'rss' => array( 'name' => 'rss_username', 'link' => 'http://*/feed' ) ); // To excerpt //======================================================= if (!function_exists('to_excerpt')) { function to_excerpt($str, $length) { $str = strip_tags($str); $str = explode(" ", $str); return implode(" ", array_slice($str, 0, $length)); } } // Go url //======================================================= if (!function_exists('to_url')) { function to_url($url) { if (!preg_match_all('!https?://[\S]+!', $url, $matches)) $url = "http://" . $url; return $url; } } // Page,Post get, print content //======================================================= function loop_content() { global $tw_options, $more; $more = 0; $readMore = !empty($tw_options['more_text']) ? $tw_options['more_text'] : __('Continue Reading -', 'themewaves'); if (has_excerpt()) { the_excerpt(); } elseif (has_more()) { the_content(""); echo '' . $readMore . ''; } elseif (!empty($tw_options['excerpt_count'])) { echo apply_filters("the_content", to_excerpt(strip_shortcodes(get_the_content()), $tw_options['excerpt_count'])); echo '' . $readMore . ''; } else { echo apply_filters("the_content", strip_shortcodes(get_the_content(""))); } } function tw_option($index1, $index2=false) { global $smof_data; if($index2){ $output = isset($smof_data[$index1][$index2]) ? $smof_data[$index1][$index2] : false; return $output; } $output = isset($smof_data[$index1]) ? $smof_data[$index1] : false; return $output; } // Page, Post custom metaboxes //======================================================= function get_metabox($name) { global $post; if ($post) { $metabox = get_post_meta($post->ID, 'themewaves_' . strtolower(THEMENAME) . '_options', true); return isset($metabox[$name]) ? $metabox[$name] : ""; } return false; } function set_metabox($name,$val) { global $post; if ($post) { $metabox = get_post_meta($post->ID, 'themewaves_' . strtolower(THEMENAME) . '_options', true); $metabox[$name] = $val; return update_post_meta($post->ID, 'themewaves_' . strtolower(THEMENAME) . '_options', $metabox); } return false; } // Print menu //======================================================= function theme_menu(){ wp_nav_menu( array( 'container' => 'div', 'container_class' => 'tw-menu-container clearfix', 'menu_id' => 'menu', 'menu_class' => 'sf-menu', 'fallback_cb' => 'no_main', 'theme_location' => 'main' ) ); } function no_main(){ echo "
"; } function mobile_menu(){ wp_nav_menu( array( 'container' => false, 'menu_id' => '', 'menu_class' => 'clearfix', 'fallback_cb' => 'no_mobile', 'theme_location' => 'main' ) ); } function no_mobile(){ echo ""; } // Footer menu //======================================================= function footer_menu(){ wp_nav_menu( array('container' => false, 'menu_class' => 'footer-menu inline', 'fallback_cb' => 'no_footer', 'depth' => 1, 'theme_location' => 'footer' ) ); } function no_footer(){ //echo ""; } // Print logo //======================================================= function theme_logo() { $top = tw_option('logo_top')!="" ? (' margin-top:'.tw_option('logo_top').'px;') : ''; $bottom = tw_option('logo_bottom')!="" ? (' margin-bottom:'.tw_option('logo_bottom').'px;') : ''; echo ''; //echo '
' . get_bloginfo('description') . '
'; } // Get featured text //======================================================= function get_featuredtext() { global $post; if (is_singular()) { $return = "

" . $post->post_title . "

"; return $return; } elseif (is_category()) { $return = "

"; $return .= __("Category", "themewaves") . " : " . single_cat_title("", false); $return .= "

"; return $return; } elseif (is_tax('portfolios')) { $return = "

"; $return .= __("Portfolio", "themewaves") . " : " . single_cat_title("", false); $return .= "

"; return $return; } elseif (is_tag()) { $return = "

"; $return .= __("Tag", "themewaves") . " : " . single_tag_title("", false); $return .= "

"; return $return; } elseif (is_404()) { $return = "

" . __("Nothing Found!", "themewaves") . "

"; return $return; } elseif (is_author()) { global $tw_author; $userdata = get_userdata($tw_author); $return = "

" . __("Author: ", "themewaves") . $userdata->display_name . "

"; return $return; } elseif (is_archive()) { $return = "

"; if (is_day()){ $return .= __("Daily Archives", "themewaves") . " : " . get_the_date(); }elseif (is_month()) { $return .= __("Monthly Archives", "themewaves") . " : " . get_the_date("F Y"); }elseif (is_year()) { $return .= __("Yearly Archives", "themewaves") . " : " . get_the_date("Y"); }else { $return .= __("Blog Archives", "themewaves"); } $return .= "

"; return $return; } elseif (is_search()) { $return = "

" . __("Search results for", "themewaves") . " : " . get_search_query() . "

"; return $return; } } // Sidebar //======================================================= function sidebar($sidebar = 'sidebar') { if (function_exists('dynamic_sidebar') && dynamic_sidebar($sidebar)) { } } function print_styles($links) { for ($i = 0; $i < count($links); $i++) { echo ''; } echo ''; if (get_settings_value('body_felement') != get_settings_value('head_felement')) { echo ''; } } if (!function_exists("current_title")) { function current_title() { global $page, $paged; echo ""; wp_title('|', true, 'right'); bloginfo('name'); $site_description = get_bloginfo('description', 'display'); if ($site_description && ( is_home() || is_front_page() )) echo " | $site_description"; if ($paged >= 2 || $page >= 2) echo ' | ' . sprintf(__('Page %s', 'themewaves'), max($paged, $page)); echo ""; } } function favicon() { if (tw_option('theme_favicon')=="") { echo ''; } else { echo ''; } if(tw_option('favicon_retina')) { echo tw_option('favicon_iphone')!="" ? ('') : ''; echo tw_option('favicon_iphone_retina')!="" ? ('') : ''; echo tw_option('favicon_ipad')!="" ? ('') : ''; echo tw_option('favicon_ipad_retina')!="" ? ('') : ''; } } function portfolio_image($height="", $width=270, $title=false) { global $post; $class = $title ? ' with-title' : ''; if (has_post_thumbnail($post->ID)) { ?>
ID)) { $overlay = "hover-link"; $link = get_permalink(); $rell = ''; $width = $portfolio ? $width : 870; $height = $portfolio ? $height : get_metabox('image_height'); if(is_single()) { $lrg_img = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); $link = $lrg_img[0]; $overlay = "hover-zoom"; $rell = ' rel="prettyPhoto"'; if($portfolio) { $width = 770; $height = get_metabox('image_height'); } } ?>
>
ID, 'gallery_image_ids', true); $gallery_height = get_post_meta($post->ID, 'format_image_height', true); $class = $title ? ' with-title' : ''; if(!empty($ids)) { ?> ID, 'format_audio_mp3', true); $embed = get_post_meta($post->ID, 'format_audio_embed', true); if (!empty($embed)) { echo apply_filters("the_content", htmlspecialchars_decode($embed)); } else { echo post_image_show(); if (!empty($audio_url)) { add_action('wp_footer', 'jplayer_script'); ?>
'; $end = ''; } } else { $video_embed = get_post_meta($post->ID, 'format_video_embed', true); $video_thumb = get_post_meta($post->ID, 'format_video_thumb', true); $video_m4v = get_post_meta($post->ID, 'format_video_m4v', true); } if (!empty($video_embed)) { echo $start; if($portfolio && !is_single()){ echo ''; echo vimeo_youtube_image(htmlspecialchars_decode($video_embed)); echo ''; echo ''; } else { echo apply_filters("the_content", htmlspecialchars_decode($video_embed)); } echo $end; } elseif (!empty($video_m4v)) { add_action('wp_footer', 'jplayer_script'); ?>
ID, 'format_quote_text', true); $quote_author = get_post_meta($post->ID, 'format_quote_author', true); if (!empty($quote_text)) { echo '
'; echo "

" . $quote_text . "

"; if (!empty($quote_author)) { echo "- " . $quote_author . ""; } echo "
"; } } function format_link() { global $post; $link_url = get_post_meta($post->ID, 'format_link_url', true); $url = !empty($link_url) ? to_url($link_url) : "#"; echo ''; } function format_status() { global $post; $status_url = get_post_meta($post->ID, 'format_status_url', true); if (!empty($status_url)) { echo apply_filters("the_content", $status_url); } } function pagination() { global $wp_query; $pages = $wp_query->max_num_pages; $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; if (empty($pages)) { $pages = 1; } if (1 != $pages) { $big = 9999; // need an unlikely integer echo ""; } } if (!function_exists('infinite')) { function infinite() { global $wp_query; $pages = intval($wp_query->max_num_pages); $paged = (get_query_var('paged')) ? intval(get_query_var('paged')) : 1; if (empty($pages)) { $pages = 1; } if (1 != $pages) { echo '
'; echo '' . __('No more posts', 'themewaves') . ''; echo '' . __('Loading posts ...', 'themewaves') . ''; echo ''; echo '
'; } } } function comment_count() { if (comments_open()) { if (tw_option('facebook_comment')) { return '';//''; } else { $comment_count = get_comments_number('0', '1', '%'); if ($comment_count == 0) { $comment_trans = __('No comment', 'themewaves'); } elseif ($comment_count == 1) { $comment_trans = __('One comment', 'themewaves'); } else { $comment_trans = $comment_count . ' ' . __('comments', 'themewaves'); } return "
  • " . $comment_trans . "
  • "; } } } if (!function_exists('mytheme_comment')) { function mytheme_comment($comment, $args, $depth) { $GLOBALS['comment'] = $comment; print '
    '; ?>
    $depth, 'max_depth' => $args['max_depth']))) ?>
    '

    ' . '

    ', 'email' => '', 'url' => '

    ' . '

    ', ); return $fields; } add_filter('comment_form_default_fields', 'tw_comment_form'); } if (!function_exists('post_image_show')) { function post_image_show($width = 0, $height = "", $returnURL=false) { global $post; if (has_post_thumbnail($post->ID)) { $attachment = get_post(get_post_thumbnail_id($post->ID)); if (isset($attachment)) { $alt = get_post_meta($attachment->ID, '_wp_attachment_image_alt', true); $alt = !empty($alt) ? $alt : $attachment->post_title; $lrg_img = wp_get_attachment_image_src($attachment->ID, 'full'); $url = $lrg_img[0]; if ($width != 0) { $url = aq_resize($url, $width, $height, true); } $urll = !empty($url)?$url:$lrg_img[0]; if($returnURL){ return $urll; }else{ return '' . $alt . ''; } } else return false; } return false; } } if (!function_exists('about_author')) { function about_author() { $tw_author = false; if (get_metabox("post_authorr") == "true") { $tw_author = true; } else if (get_metabox("post_authorr") != "false") { if (tw_option('post_author')) { $tw_author = true; } } if ($tw_author) { ?>

    ID, 'portfolios', array("fields" => "ids")); if ($tags) { $rel_title = __("Related portfolio items", "themewaves"); echo do_shortcode('[tw_item_title title="' . $rel_title . '"]'); $tag_ids = ""; foreach ($tags as $tag) $tag_ids .= $tag . ","; $query = Array( 'post_type' => 'portfolio', 'posts_per_page' => '4', 'post__not_in' => array($post->ID), 'tax_query' => Array(Array( 'taxonomy' => 'portfolios', 'terms' => $tag_ids, 'field' => 'id' )) ); query_posts($query); $tw_options['pagination'] = 'none'; echo '
    '; get_template_part("loop", "portfolio"); echo '
    '; } } function tw_social() { global $tw_socials; foreach ($tw_socials as $key => $social) { if(tw_option($social['name'])!=""){ echo ''; } } } function vimeo_youtube_image($embed) { preg_match('/src=\"(.*?)\"/si', $embed, $filteredContent); if(!empty($filteredContent[1])) { $url = $filteredContent[1]; $youtube = strpos($url, 'youtube.com'); $youtu = strpos($url, 'youtu.be'); $vimeo = strpos($url, 'vimeo.com'); $video_id = ''; $spliturl = split("/", $url); $video_id = $spliturl[count($spliturl) - 1]; if ($video_id == "") { $video_id = $spliturl[count($spliturl) - 2]; } } else { $url = $embed; $youtube = strpos($url, 'youtube.com'); $youtu = strpos($url, 'youtu.be'); $vimeo = strpos($url, 'vimeo.com'); $video_id = ''; $spliturl = split("/", $url); $video_id = $spliturl[count($spliturl) - 1]; if ($video_id == "") { $video_id = $spliturl[count($spliturl) - 2]; } else { $spliturl = split("=", $url); $video_id = $spliturl[count($spliturl) - 1]; } } $video_img = ''; if ($youtube || $youtu) { $video_img = ''; } else if ($vimeo) { $json = @file_get_contents("http://vimeo.com/api/oembed.json?url=http%3A//vimeo.com/" . $video_id, true); if (strpos($http_response_header[0], "200")) { $data = json_decode($json, true); $video_thumb = $data['thumbnail_url']; $video_thumb = str_replace("_1280", "_640", $video_thumb); $video_img = ''; } if (strlen($video_img) < 1) { $video_img = ""; } } return $video_img; }