Hi there,
I am using a blog application and would really like to have a feature on my home page that allows the first 5 post title to display like a news ticker.
I have some PHP code that currently lists the 5 most recent news titles like this:
09.10.2004 - News title here
08.10.2004 - News title here
Each of the above links to that news story.
I am using this code to do this:
<?php
function get_recent_posts_with_date($no_posts = 3, $before = '<li>', $after = '</li>', $show_pass_post = false, $skip_posts = 0) {
global $wpdb, $tableposts;
$request = "SELECT ID, post_title, DATE_FORMAT(post_date,'%d.%m.%Y') as postdate FROM $tableposts WHERE post_status = 'publish' ";
if(!$show_pass_post) { $request .= "AND post_password ='' "; }
$request .= "ORDER BY post_date DESC LIMIT $skip_posts, $no_posts";
$posts = $wpdb->get_results($request);
$output = '';
foreach ($posts as $post) {
$post_date = $post->postdate;
$post_title = stripslashes($post->post_title);
$permalink = get_permalink($post->ID);
$output .= $before . '<a href="' . $permalink . '" rel="bookmark" title="Permanent Link: ' . $post_title . '"> <strong>' . $post_date . "</strong> - " . $post_title . '</a>' . $after;
}
echo $output;
}
?>
Does anyone know how to change this code to display the news titles one at a time in a news ticker enviroment?
Many thanks