Support » Fixing WordPress » Help with Headlines

  • This might get confusing, but bear with me:

    I wanted a headlines list on my homepage (static, HTML)

    I found the php code for a Mini-loop.

    Now, I can’t put php into my html homepage, so I got a little creative-
    I made a page with the loop in it, saved as php, and <IFRAMED> the new page into the homepage.

    This works great, but with 2 exceptions:
    1) the list of headlines is justified as “center” and needs to be”left”
    2) (and most importantly) The links open in the IFRAME and need to open in a new window (i.e. – target=”_new”)

    Here is the php for the loop so far:

    <?php define(‘WP_USE_THEMES’, false);
    <div id=”content” class=”narrowcolumn”>

    <h2>Lastest Posts:</h2>

    # 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_status = \”publish\” ORDER BY ID DESC LIMIT “.$how_many);
    foreach($news as $np){
    printf (”

  • href=\”bloghome.htm?p=%s\”>%s
  • “, $np->ID,$np->post_title);



    NOTE: had to pull “ tags this time either!

  • The topic ‘Help with Headlines’ is closed to new replies.