Support » Fixing WordPress » mini-loop on static html

  • Resolved noname1

    (@greyisgood)


    I am trying to add the 10 most recent posts from my blog to the homepage of my website (a static html).

    When I follow these instructions this is the output I get:

    # get_results(“SELECT ID,post_title FROM $wpdb->posts WHERE post_status= \”publish\” ORDER BY ‘ID’ DESC LIMIT “.$how_many); foreach($news as $np){ print (“ID); print (“\”>$np->post_title
    “); } ?>

    I’ve tried various tweaks, all fail… Can anyone help me out, so I can update the codex page (tagged as needed edit)… quite a few having this same problem

Viewing 3 replies - 1 through 3 (of 3 total)
  • really stuck with this one…

    You can’t do it with an HTML page. It needs to be a page that can take PHP (so use .phtml, .phtm, or .php). I’m not sure why that page in the codex lists all those pages that aren’t capable of running PHP. The reason your page is simply rendering the PHP as text is because the server doesn’t think a page with an HTML extension should run PHP scripts. Change it to .phtml and you should see a difference.

    that works!

    Thanks for your help on that one… there are some wrongers in the codex 😉

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘mini-loop on static html’ is closed to new replies.