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 "";
wp_list_pages(array('title_li' => ''));
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)) {
?>
1) { echo '
'; } else {$img_url = wp_get_attachment_url($id);}?>
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 '';
echo '
';
echo '
- ' . $url . ' ';
}
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 '';
}
}
}
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 "";
}
}
}
if (!function_exists('mytheme_comment')) {
function mytheme_comment($comment, $args, $depth) {
$GLOBALS['comment'] = $comment;
print '
' . '
', 'email' => '' . '
', 'url' => '' . '