function woo_tumblog_content($return = false) { global $post; $post_id = $post->ID; //check if it is a tumblog post //check which tumblog $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) { $content = woo_tumblog_article_content($post_id); } elseif ($tumblog_items['images'] == $tumblog_id->term_id && !$sentinel) { $content = woo_tumblog_image_content($post_id); } elseif ($tumblog_items['audio'] == $tumblog_id->term_id && !$sentinel) { $content = woo_tumblog_audio_content($post_id); } elseif ($tumblog_items['video'] == $tumblog_id->term_id && !$sentinel) { $content = woo_tumblog_video_content($post_id); } elseif ($tumblog_items['quotes'] == $tumblog_id->term_id && !$sentinel) { $content = woo_tumblog_quote_content($post_id); } elseif ($tumblog_items['links'] == $tumblog_id->term_id && !$sentinel) { $content = woo_tumblog_link_content($post_id); } else { $content = ''; } } // Return or echo the content if ($return == TRUE) { return $content; } else { echo $content; } // Done }
function woo_tumblog_content($output = 'Before', $return = false) { global $post; $post_id = $post->ID; $content = ''; // Declare empty variable to prevent warning messages. // Test for Post Formats if (get_option('woo_tumblog_content_method') == 'post_format') { if (has_post_format('aside', $post_id)) { if ($output == get_option('woo_woo_tumblog_images_content')) { $content = woo_tumblog_article_content($post_id); } } elseif (has_post_format('image', $post_id)) { if ($output == get_option('woo_woo_tumblog_images_content')) { $content = woo_tumblog_image_content($post_id); } } elseif (has_post_format('audio', $post_id)) { if ($output == get_option('woo_woo_tumblog_audio_content')) { $content = woo_tumblog_audio_content($post_id); } } elseif (has_post_format('video', $post_id)) { if ($output == get_option('woo_woo_tumblog_videos_content')) { $content = woo_tumblog_video_content($post_id); } } elseif (has_post_format('quote', $post_id)) { if ($output == get_option('woo_woo_tumblog_quotes_content')) { $content = woo_tumblog_quote_content($post_id); } } elseif (has_post_format('link', $post_id)) { $content = woo_tumblog_link_content($post_id); } else { $content = ''; } } else { //check if it is a tumblog post //check which tumblog $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) { $content = woo_tumblog_article_content($post_id); } elseif ($tumblog_items['images'] == $tumblog_id->term_id && !$sentinel) { if ($output == get_option('woo_woo_tumblog_images_content')) { $content = woo_tumblog_image_content($post_id); } } elseif ($tumblog_items['audio'] == $tumblog_id->term_id && !$sentinel) { if ($output == get_option('woo_woo_tumblog_audio_content')) { $content = woo_tumblog_audio_content($post_id); } } elseif ($tumblog_items['video'] == $tumblog_id->term_id && !$sentinel) { if ($output == get_option('woo_woo_tumblog_videos_content')) { $content = woo_tumblog_video_content($post_id); } } elseif ($tumblog_items['quotes'] == $tumblog_id->term_id && !$sentinel) { if ($output == get_option('woo_woo_tumblog_quotes_content')) { $content = woo_tumblog_quote_content($post_id); } } elseif ($tumblog_items['links'] == $tumblog_id->term_id && !$sentinel) { $content = woo_tumblog_link_content($post_id); } else { $content = ''; } } } // Return or echo the content if ($return == TRUE) { return $content; } else { echo $content; } // Done }