Need help with recent posts on sidebar

Discussion in 'WordPress' started by flowknight, Jun 1, 2012.

  1. #1
    Can anyone please help me out with this? How can i make recent post style like this? Check the picture.

    recent post.JPG

    Thanks in advance
     
    flowknight, Jun 1, 2012 IP
  2. Imposter

    Imposter Peon

    Messages:
    169
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I do not know how to do the styling (you must look in the source code). This is the code which generates a list of 5 recent posts:

    
    <ul>
    <?php
    $myposts = get_posts('numberposts=5&offset=0&category=0');
    foreach($myposts as $post) : setup_postdata($post);
    ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>
    </ul>
    PHP:
     
    Imposter, Jun 1, 2012 IP
  3. flowknight

    flowknight Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    But i need the style. :(
     
    flowknight, Jun 1, 2012 IP
  4. Imposter

    Imposter Peon

    Messages:
    169
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Well, I cannot help you without the URL. I do not have a crystal ball.
    (Maybe someone else could, but who would bother if you can just copy it from the original page exactly how it is displayed?)
     
    Imposter, Jun 1, 2012 IP
  5. Imposter

    Imposter Peon

    Messages:
    169
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Imposter, Jun 1, 2012 IP
  6. raoraj

    raoraj Well-Known Member

    Messages:
    849
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    110
    #6
    you need to edit CSS of your current theme.
    if you don't know how to this, then you need to learn it.
     
    raoraj, Jun 1, 2012 IP
  7. robaid

    robaid Member

    Messages:
    126
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    35
    #7
    Imposter asked you about the website you want to steal the idea from, not your own website :)
     
    robaid, Jun 1, 2012 IP
  8. Imposter

    Imposter Peon

    Messages:
    169
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #8
    This style should do the job.

    
    <style>
    li{
    list-style-type:none;
    background:#fffff;
    border: 0.1em solid #0F97DB;
    -moz-border-radius:4px;
    padding:0.5em;
    margin:0.5em;
    }
    </style>
    
    <ul>
                    <li><a href="http://www.techmaish.com/the-latest-in-networking-technology/" title="The Latest in Networking Technology">The Latest in Networking Technology</a></li>
                    <li><a href="http://www.techmaish.com/best-branding-for-your-business/" title="Best Branding For Your Business">Best Branding For Your Business</a></li>
                    <li><a href="http://www.techmaish.com/social-media-mistakes-to-be-avoided-by-pr-pros/" title="Social Media Mistakes to be Avoided by PR Pros">Social Media Mistakes to be Avoided by PR Pros</a></li>
                    <li><a href="http://www.techmaish.com/advantage-over-competitor-with-internet-marketing/" title="Advantage Over Competitor With Internet Marketing">Advantage Over Competitor With Internet Marketing</a></li>
                    <li><a href="http://www.techmaish.com/most-epically-massive-photos-ever-taken/" title="Most Epically Massive Photos Ever Taken">Most Epically Massive Photos Ever Taken</a></li>
                    </ul>
    HTML:
     
    Imposter, Jun 2, 2012 IP
  9. flowknight

    flowknight Peon

    Messages:
    46
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Where would i put that? :confused:
     
    flowknight, Jun 2, 2012 IP
  10. Imposter

    Imposter Peon

    Messages:
    169
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #10
    If you save the code in a file and open in a web browser, you can see that it styles the <li> elements. Just assign an ID (for example "coollist") to the <ul> to the list of recent posts and then rename the style class to #coollist li.
     
    Imposter, Jun 2, 2012 IP