php - Getting last 5 post titles from WordPress and it's thumbnail -


i'm creating news slider , looks this

< ___________ #slidecontent _______________>  <#slidemenu> ┌────────────────────────────────────────────┬────────────┐ │                                            │<1st title> │ │                                            ├────────────┤ │       (thumbnail of hovered title (1st))   │ 2nd title  │ │                                            ├────────────┤ │                 (\___/)                    │ 3rd title  │ │                 (=’.'=)                    ├────────────┤ │                 (")_(")                    │ 4th title  │ │                                            ├────────────┤ │                                            │ 5th title  │ └────────────────────────────────────────────┴────────────┘ < > means hovered  bunny article's thumbnail of hovered title. :) 

and here code of it.

<div id="slideshow">  <div id="slidecontent">     <?php ???get thumbnail of hovered title?? ?>  </div>  <div id="slidemenu">          <div id="slidem1" class="marbo20"><?php ??get title of last post??></div>          <div id="slidem2" class="marbo20"><?php ??get title of 2nd last post??></div>          <div id="slidem3" class="marbo20"><?php ??get title of 3rd last post??></div>          <div id="slidem4" class="marbo20"><?php ??get title of 4th last post??></div>          <div id="slidem5"><?php ??get title of 5th last post??></div>  </div> </div> 

i don't know type #slidem1, #slidem2, #slidem3, #slidem4, #slidem5 divs , place inside slidecontent.

thank help. :)

you may need modify divs here solution in <ul> list (from wordpress codex):

<ul> <?php  global $post;  $args = array(     'numberposts' => 5,     'orderby' => 'post_date',     'order' => 'desc',     'post_type' => 'post',     'post_status' => 'publish' );  $myposts = get_posts( $args );  foreach( $myposts $post ) : setup_postdata($post); ?>     <li>         <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>     </li> <?php endforeach; ?> </ul> 

here div version example i've made. thing missing post thumbnails:

 <div id="slideshow">  <div id="slidecontent">   </div>  <div id="slidemenu">     <?php      global $post;      $args = array(         'numberposts' => 5,         'orderby' => 'post_date',         'order' => 'desc',         'post_type' => 'post',         'post_status' => 'publish'     );      $myposts = get_posts( $args );             $count = 0;      foreach( $myposts $post )     {         $count++;         setup_postdata($post);     ?>         <div id="slidem<?php echo $count; ?>" class="marbo20"><a href="<?php echo the_permalink(); ?>"><?php the_title(); ?></a></div>     <?php } ?> </div> </div> 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -