WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Horizontal marquee "recent posts" (5 posts)

  1. aqdam
    Member
    Posted 3 years ago #

    Hello,
    this following code displays a basic horizontal marquee for the 5 recent posts. I would like that the titles are seperated by a space and a symbole of my choice. exaple: "title1 | title2 | title3...".

    I hope you could help with this. I googled to find a ready marquee but I didn't find anyone. I think many would use it a the head of the page. and it is so attractive like as a slideshow.

    <marquee behavior="scroll" direction="right">
    <h2>
    <?php
    	$args = array( 'numberposts' => '5');
    	$recent_posts = wp_get_recent_posts( $args  );
    	foreach( $recent_posts as $post ){
    		echo '<a href="' . get_permalink($post["ID"]) . '" title="Look '.$post["post_title"].'" >'.   $post["post_title"].  '</a>';
    	}
    ?>
    </h2>
    </marquee>
  2. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    added separator to a foreach list of links:

    http://pastebin.com/HT3HwPED

  3. aqdam
    Member
    Posted 3 years ago #

    Thanks very much. It is working. It was originally a list, but it works also as a scrolling marquee. I putted it above the mainpage. So, anyone who want a scrolling marquee he can use this.

    I tested other possibilities, and it seems that it works when i add a symobol in the echo line before the <a... and after the /a>, to get title between << >> as example.

  4. robertbenge
    Member
    Posted 3 years ago #

    This is great, thanks!

    I would like to show the latest post from one category, and then the latest post from a second category so it would be like

    New Category1 Post: Post1 title | New Category2 Post: Post2 Title

    I can't work it out though!

    Thanks.

  5. Sinfullysweet
    Member
    Posted 2 years ago #

    This is what I have been looking for. I love what you have done, but wonder one thing. How can I get the featured image to pull up associated with that post?

Topic Closed

This topic has been closed to new replies.

About this Topic