• Resolved aqdam

    (@aqdam)


    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>
Viewing 4 replies - 1 through 4 (of 4 total)
  • Michael

    (@alchymyth)

    added separator to a foreach list of links:

    https://pastebin.com/HT3HwPED

    Thread Starter aqdam

    (@aqdam)

    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.

    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.

    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?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Horizontal marquee "recent posts"’ is closed to new replies.