Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Forum: Fixing WordPress
    In reply to: .htaccess issue

    Your server isn’t a windows server is it?

    Thread Starter castus

    (@castus)

    Whenever I try to set up the code as shown, the PHP fails and nothing is outputted.

    I tried putting in echo ‘test’; throughout the code to see where it stops. It stopped right after require(‘/news/wp-blog-header.php’);. I changed this to include rather than require and the php got to the next line, but failed again at get_header();

    I have made a fresh php file and only have the code on the create a static page in the php file. But it doesn’t seem to be working.

    My wp install is in /news/ and here is my code so far (all i want it a list of posts)

    <?php
    define(‘WP_USE_THEMES’, false);
    include(‘/news/wp-blog-header.php’);
    // get_header();
    ?>
    <div id=”content” class=”narrowcolumn”>
    <?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=7; //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_type’=\”post\” AND ‘post_status’= \”publish\” ORDER BY ‘ID’ DESC LIMIT “.$how_many);
    foreach($news as $np){
    printf (“<.li><.a href=\”/news/index.php?p=%s\”>%s</.a></.li>”, $np->ID,$np->post_title);
    }
    ?>

    </div>

Viewing 2 replies - 1 through 2 (of 2 total)