function display_timeline($args) { $post_args = array('post_type' => get_option('timeline_post_type'), 'numberposts' => get_option('timeline_show_posts'), 'category' => get_option('timeline_post_category'), 'orderby' => 'post_date', 'order' => get_option('timeline_order_posts'), 'post_status' => 'publish', 'post_link' => get_option('timeline_post_link')); $posts = get_posts($post_args); $out .= '<div id="timeline">'; $out .= '<ul>'; foreach ($posts as $post) { setup_postdata($post); $out .= '<li><div>'; if (get_option('timeline_post_link') == 'yes') { $out .= '<span><h4 class="timeline-date">'; $out .= get_the_time(get_option('timeline_date_format'), $post->ID); $out .= '</h4></span>'; $out .= '<a href="' . get_permalink($post->ID) . '" title="' . $post->title . '"><h3 class="timeline-date">'; if (get_option('timeline_show_titles') == 'yes') { $out .= " " . get_the_title($post->ID) . " "; } $out .= '</h3></a>'; } else { $out .= '<span><h3 class="timeline-date">'; $out .= get_the_time(apply_filters('timeline_date_format', get_option('timeline_date_format')), $post->ID); if (get_option('timeline_show_titles') == 'yes') { $out .= " " . get_the_title($post->ID) . " "; } $out .= '</h3><span>'; } if (get_option('timeline_include_images') == 'yes') { if (featured_image() == true && has_post_thumbnail($post->ID)) { $out .= '<span class="timeline-image">' . get_the_post_thumbnail($post->ID, 'timeline-thumb') . '</span>'; } } $out .= '<span class="timeline-text">' . timeline_text(get_option('timeline_text_length')) . '</span>'; $out .= '<span class="timeline-text"><h6>' . tags_text(wp_get_post_tags($post->ID)) . '</h6></span>'; $out .= '</div></li>'; } $out .= '</ul>'; $out .= '</div> <!-- #timeline -->'; wp_reset_postdata(); return $out; }
function tag_text($selector, $source = false) { $texts = tags_text($selector, $source); $text = reset($texts); re($text); return $text; }