WordPress.org

Ready to get started?Download WordPress

Forums

Home Page with static info AND posts? (7 posts)

  1. James
    Member
    Posted 7 years ago #

    Hello everyone,

    I’m looking for something similar to the issues raised in the thread (however it was resolved):
    http://wordpress.org/support/topic/123681
    [mod: every URL starts with http!]

    I want to have a static page with basic info of my site, along with a few (maybe 2 or 3 of the most recent) “news update posts” from a “site news” category I created, below it.

    (Maybe even hiding the “site news” category from my other categories list in my sidebar, however hiding it isn’t completely necessary for me.)

    Thanks

  2. Root
    Member
    Posted 7 years ago #

    Just hard code your stuff into index.php

  3. James
    Member
    Posted 7 years ago #

    I'm not that good at "hard coding" (Although I will if I have to), I thought there may be some function in the option menu (or plugin) that may allow these sort of features.

  4. James
    Member
    Posted 7 years ago #

    Will this plugin solve my problem?
    http://wordpress.org/extend/plugins/page2cat/

    Although it says it is for developers only.

  5. Chris_K
    Member
    Posted 7 years ago #

  6. James
    Member
    Posted 7 years ago #

    OK that last post looks a little off (and I can't edit it), I'll try entering it again:

    <?php
    $how_many=5; //How many posts do you want to show
    require_once("http://www.toptenlisted.com/wp-config.php"); // Change this for your path to wp-config.php file ?>
    <ol id="whats-new">
    <?
    $news=$wpdb->get_results("SELECT <code>ID</code>,<code>post_title</code> FROM $wpdb->posts
    WHERE <code>post_status</code>= \"publish\" ORDER BY 'ID' DESC LIMIT ".$how_many);
    foreach($news as $np){
    print ("<li><a href=\"");
    echo get_permalink($np->ID);
    print ("\">$np->post_title</a></li>");
    } ?>
    </ol>
  7. Root
    Member
    Posted 7 years ago #

    I would simply open index.php and just before the loop gets started - I would post in my static content. Below it come my posts. In admin set the number of posts shown to 3. No hackery needed.

Topic Closed

This topic has been closed to new replies.

About this Topic