function woo_tumblog_taxonomy_link($post_id, $return = true)
{
    // Test for Post Formats
    if (get_option('woo_tumblog_content_method') == 'post_format') {
        if (has_post_format('aside', $id)) {
            $tumblog_results = 'articles';
            $sentinel = true;
        } elseif (has_post_format('image', $id)) {
            $tumblog_results = 'images';
            $sentinel = true;
        } elseif (has_post_format('audio', $id)) {
            $tumblog_results = 'audio';
            $sentinel = true;
        } elseif (has_post_format('video', $id)) {
            $tumblog_results = 'video';
            $sentinel = true;
        } elseif (has_post_format('quote', $id)) {
            $tumblog_results = 'quotes';
            $sentinel = true;
        } elseif (has_post_format('link', $id)) {
            $tumblog_results = 'links';
            $sentinel = true;
        } else {
            $tumblog_results = 'articles';
            $sentinel = false;
        }
        $term_name = esc_attr(get_post_format_string(get_post_format()));
    } else {
        $tumblog_list = get_the_term_list($post_id, 'tumblog', '', '|', '');
        $tumblog_array = explode('|', $tumblog_list);
        $tumblog_items = array('articles' => get_option('woo_articles_term_id'), 'images' => get_option('woo_images_term_id'), 'audio' => get_option('woo_audio_term_id'), 'video' => get_option('woo_video_term_id'), 'quotes' => get_option('woo_quotes_term_id'), 'links' => get_option('woo_links_term_id'));
        //switch between tumblog taxonomies
        $tumblog_list = strip_tags($tumblog_list);
        $tumblog_array = explode('|', $tumblog_list);
        $tumblog_results = '';
        $sentinel = false;
        foreach ($tumblog_array as $tumblog_item) {
            $tumblog_id = get_term_by('name', $tumblog_item, 'tumblog');
            if ($tumblog_items['articles'] == $tumblog_id->term_id && !$sentinel) {
                $tumblog_results = 'articles';
                $category_id = $tumblog_items['articles'];
                $sentinel = true;
            } elseif ($tumblog_items['images'] == $tumblog_id->term_id && !$sentinel) {
                $tumblog_results = 'images';
                $category_id = $tumblog_items['images'];
                $sentinel = true;
            } elseif ($tumblog_items['audio'] == $tumblog_id->term_id && !$sentinel) {
                $tumblog_results = 'audio';
                $category_id = $tumblog_items['audio'];
                $sentinel = true;
            } elseif ($tumblog_items['video'] == $tumblog_id->term_id && !$sentinel) {
                $tumblog_results = 'video';
                $category_id = $tumblog_items['video'];
                $sentinel = true;
            } elseif ($tumblog_items['quotes'] == $tumblog_id->term_id && !$sentinel) {
                $tumblog_results = 'quotes';
                $category_id = $tumblog_items['quotes'];
                $sentinel = true;
            } elseif ($tumblog_items['links'] == $tumblog_id->term_id && !$sentinel) {
                $tumblog_results = 'links';
                $category_id = $tumblog_items['links'];
                $sentinel = true;
            } else {
                $tumblog_results = 'articles';
                $category_id = 0;
                $sentinel = false;
            }
        }
    }
    $category_link = woo_tumblog_category_link($post_id, $tumblog_results);
    if ($return) {
        echo '<a href="' . $category_link . '" title="' . $term_name . '">' . $term_name . '</a>';
    } else {
        return $category_link;
    }
}
Пример #2
0
function woo_tumblog_audio($post_id = 0, $count = 0, $pagetype = '')
{
    $service = get_option('woo_url_shorten');
    $category_link = woo_tumblog_category_link($post_id, 'audio');
    ?>
	<div class="post audio-post">
				
        <div class="posttype">
        	<a href="<?php 
    echo $category_link;
    ?>
" title="<?php 
    echo esc_attr(get_post_format_string(get_post_format()));
    ?>
"><img src="<?php 
    bloginfo('template_directory');
    ?>
/images/ico-audio.png" alt="" /></a>
        </div><!-- /.posttype -->
                
	    <?php 
    if (is_singular()) {
        ?>
	    <h1 class="title"><a href="<?php 
        the_permalink();
        ?>
" rel="bookmark" title="<?php 
        the_title();
        ?>
"><?php 
        the_title();
        ?>
</a></h1>
	    <?php 
    } else {
        ?>
	    <h2 class="title"><a href="<?php 
        the_permalink();
        ?>
" rel="bookmark" title="<?php 
        the_title();
        ?>
"><?php 
        the_title();
        ?>
</a></h2>
	    <?php 
    }
    ?>
	    
	    <?php 
    woo_post_meta();
    ?>
             
	            
        <div class="media">
		    <div id='mediaspace<?php 
    echo $post_id;
    ?>
'></div>
		    <?php 
    //Post Args
    $args = array('post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post_id);
    //Get attachements
    $attachments = get_posts($args);
    if ($attachments) {
        foreach ($attachments as $attachment) {
            $link_url = $attachment->guid;
        }
    } else {
        $link_url = get_post_meta($post_id, 'audio', true);
    }
    if (!empty($link_url)) {
        ?>
		    <script type='text/javascript'>
		      var so = new SWFObject('<?php 
        bloginfo('template_directory');
        ?>
/includes/tumblog/player.swf','mpl','440','32','9');
		      so.addParam('allowfullscreen','true');
		      so.addParam('allowscriptaccess','always');
		      so.addParam('wmode','opaque');
		      so.addParam('wmode','opaque');
		      so.addVariable('skin', '<?php 
        bloginfo('template_directory');
        ?>
/includes/tumblog/stylish_slim.swf');
		      so.addVariable('file','<?php 
        echo $link_url;
        ?>
');
		      so.addVariable('backcolor','000000');
		      so.addVariable('frontcolor','FFFFFF');
		      so.write('mediaspace<?php 
        echo $post_id;
        ?>
');
		    </script>
		    <?php 
    }
    ?>
		</div><!-- /.audioplayer -->
        
        <div class="entry">
        	<?php 
    if (get_option('woo_home_content') == 'false' && is_home() || get_option('woo_archive_content') == 'false' && (is_archive() || is_search() || is_tax())) {
        the_excerpt();
    } elseif ($pagetype == 'archive' && get_option('woo_archive_content') == 'false') {
        the_excerpt();
    } elseif ($pagetype == 'home' && get_option('woo_home_content') == 'false') {
        the_excerpt();
    } else {
        the_content();
    }
    ?>
        </div>

	    <div class="post-more">      
	    		<span class="comments"><?php 
    comments_popup_link(__('0 Comments', 'woothemes'), __('1 Comments', 'woothemes'), __('% Comments', 'woothemes'));
    ?>
</span>
	    		<?php 
    if ($service != 'Off') {
        ?>
<span class="shorturl"><a href="<?php 
        echo woo_short_url(get_permalink());
        ?>
" title="<?php 
        _e('Short URL for', 'woothemes');
        ?>
 <?php 
        the_title();
        ?>
"><?php 
        _e('Short URL', 'woothemes');
        ?>
</a></span><?php 
    }
    ?>
				<?php 
    the_tags('<span class="tags">', ', ', '</span>');
    ?>
	    </div>  
                                    
    </div><!-- /.post -->
	
	<?php 
}