Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Apr 2008
    Location
    New York
    Posts
    142
    Thanks
    1
    Thanked 0 Times in 0 Posts

    random blog articles

    hey, I would like to have a column on my sidebar on the homepage to show like 5-10 random blog posts, how can I do this?

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,539
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts
    Is this WordPress?

  • #3
    Regular Coder
    Join Date
    Apr 2008
    Location
    New York
    Posts
    142
    Thanks
    1
    Thanked 0 Times in 0 Posts
    yes it is wordpress

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,539
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts
    If it shows the random blog posts, won't some of them
    be really big (lots of text) and some be small ... and
    some of them have images?

    Are you talking about displaying random post literally,
    or just a list of random links to your posts?

    There's not much room in the sidebar for complete posts?

    EDIT:
    To find out how many posts there are, you use this PHP coding ...
    PHP Code:
    $numposts $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
    if (
    $numposts$numposts number_format($numposts); 
    Each post is displayed by a number, example:
    http://www.mywebsite.com/blog/?p=23

    So, if you were to pick a random number between 1 and $numposts,
    you would be displaying a valid post. If you wanted 5 random posts,
    the trick would be to pick 5 of them, without repeating any.



    ,
    Last edited by mlseim; 10-02-2008 at 12:56 AM.

  • #5
    Regular Coder
    Join Date
    Apr 2008
    Location
    New York
    Posts
    142
    Thanks
    1
    Thanked 0 Times in 0 Posts
    my website is www.paranormalknowledge.com

    I want on the sidebar below popular articles to have the same thing but produce 5 random articles with the names displayed like popular articles. How do I do that? What you just showed me?

  • #6
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,539
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts
    ?? It looks to me like it already has 5 random articles ??

    I'm confused.

  • #7
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,539
    Thanks
    8
    Thanked 1,093 Times in 1,084 Posts
    PPP,
    What does that question mean?

    Are you asking about how to install WordPress and use it on your website?

  • #8
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,865
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    No! He's likely to be spamming the links in his signature.
    Edit:
    Um.. it's not his signature! Oh.. he's banned now
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •