WordPress.org

Ready to get started?Download WordPress

Forums

Static Frontpage (4 posts)

  1. jantsu
    Member
    Posted 7 years ago #

    Hello everybody, i wanna static frontpage wich shows only 1 or 2 posts. Can you please give me an example what do i have do in home.php?
    I found this one but it shows only links.

    <div id="content" class="narrowcolumn"><h1 style="color:#000;">Welcome to my site</h1>
    Hello and welcome to my site. You can go to my web page about how to improve your
    shoots with your digital camera; or you can go to my blog
    <h2>Lastest posts in my blog:</h2>

    <?php
    # Here starts Mini Loop trick: You can use this code, but _at your own risk_
    # If you want to improve this code, you're welcome ;)

    $how_many=2; //How many posts do you want to show ?>
    <ul class="whats-new">
    <?
    $news=$wpdb->get_results("SELECT ID,post_title FROM $wpdb->posts
    WHERE post_status = \"publish\" ORDER BY ID DESC LIMIT ".$how_many);
    foreach($news as $np){
    printf ("

  2. %s
  3. ", $np->ID,$np->post_title);
    }?>

    </div>

    Thank you very much.

  • Samuel B
    moderator
    Posted 7 years ago #

  • jantsu
    Member
    Posted 7 years ago #

    That´s not what i want.. but thanks anyway.

  • jantsu
    Member
    Posted 7 years ago #

    Anyone help? How can i show 2 posts in my frontpage and 10 post in categories? I really need this option but i don´t know how to do it.

  • Topic Closed

    This topic has been closed to new replies.

    About this Topic

    Tags