I want to display latest post in marquee

?php
/*
Plugin Name: Breaking News
*/

function rif_breaking_news(){
        
        
?
div class=breaking_news_box style=background: none repeat scroll 0 0 #2E8B57;bottom: 0;color: #CCCCCC;direction: ltr;height: 32px;left: 0;min-width: 600px;position: fixed;width: 100%;z-index: 99935; id=breaking_news     
    b class=breaking_headLatest News:/b
    ul style=margin:4px;

        
        marquee 
        behavior=scroll direction=left scrollamount=3 scrolldelay=60 onmouseover=this.stop() onmouseout=this.start()
        ?php $latest = get_posts('numberposts=5'.'offset='.'cat=13'); foreach( $latest as $post ): ?
        
        a href=?php the_permalink(); ??php the_title(); ?/a nbsp; nbsp;
        ?php endforeach; ?
    /marquee
    
    /ul
/div

?php
}
add_action('wp_footer','rif_breaking_news');
function rif_css_fileLink(){
echo 'link rel=stylesheet type=text/css href='.plugin_dir_url(__FILE__).'css/style.css ';
}
add_action('wp_head','rif_css_fileLink');
?

Topic functions Wordpress

Category Web


You are using a local loop, so template functions won't behave as expected without a $post parameter:

<marquee>
    <?php $latest = get_posts('numberposts=5&cat=13'); foreach( $latest as $_post ) : ?>
    
        <a href="<?php the_permalink( $_post ); ?>"><?= get_the_title( $_post ); ?></a> &nbsp; &nbsp;

    <?php endforeach; ?>
</marquee>

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.