• I read up on the info provided by codex on how to setup a mini loop on a page outside of wordpress and that’s working fine, but im having such a hard time. This is the code im using:

    <?php
    $how_many=5; //How many posts do you want to show
    require_once('domains/news.deaf-monkey.com/html/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_type</code>=\"post\" AND <code>post_status</code>=\"publish\" ORDER BY post_date DESC LIMIT $how_many");
    foreach($news as $np){
    printf ("<li><a href=\"http://news.deaf-monkey.com/index.php?p=%s\">%s</a></li>", $np->ID,$np->post_title);
    }?>
    </ol>

    But the problem im having is whenever i try to modify it i just end up messing it up, i was wondering if anyone could help me customize it in such a way that i can remove the way it uses a numbering system to display the posts. To make it easier i think the latest blog posts section at the bottom of http://www.dreamten.com is exactly how i want my mini-loop to look like, which shows the date, comments and even the small 1px margins separating each post.

Viewing 9 replies - 16 through 24 (of 24 total)
  • Thread Starter deaftone

    (@deaftone)

    I think it’s on now, here it is:

    <?php
    $how_many=5; //How many posts do you want to show
    require_once('/nfs/c03/h04/mnt/57867/domains/news.deaf-monkey.com/html/wp-config.php'); // Change this for your path to wp-config.php file ?>
    
    <ul id="whats-new">
    <?
    $news=$wpdb->get_results("SELECT <code>ID</code>,<code>post_title</code>,<code>comment_count</code>,<code>post_date</code> FROM $wpdb->posts
    WHERE <code>post_type</code>=\"post\" AND <code>post_status</code>=\"publish\" ORDER BY post_date DESC LIMIT $how_many");
    foreach($news as $np){
    printf ("<li><a href=\"%s\">%s</a> Posted: %s Comments: %s</li>", get_permalink($np->ID),$np->post_title,$np->post_date,$np->comment_count);
    } ?>
    </ul>

    It’s showing nothing atm. http://www.deaf-monkey.com

    Ok I am sorry I am making you more confused. Put your permalinks back to Default because they worked at one time.

    <?php
    $how_many=5; //How many posts do you want to show
    require_once('domains/news.deaf-monkey.com/html/wp-config.php'); // Change this for your path to wp-config.php file ?>
    
    <ul id="whats-new">
    <?
    $news=$wpdb->get_results("SELECT <code>ID</code>, <code>comment_count</code>, <code>post_date</code>,<code>post_title</code> FROM $wpdb->posts
    WHERE <code>post_type</code>=\"post\" AND <code>post_status</code>=\"publish\" ORDER BY post_date DESC LIMIT $how_many");
    foreach($news as $np){
    printf ("<li>%s <a href=\"http://news.deaf-monkey.com/index.php?p=%s\">%s</a> %s</li>", $np->post_date,$np->ID,$np->post_title,$np->comment_count);
    }?>
    </ul>
    Thread Starter deaftone

    (@deaftone)

    Alright, i just put permalinks back to default
    and i just used the code you posted, still shows nothing ); dammit

    interesting…can you put your original code in and see if it works again?

    Thread Starter deaftone

    (@deaftone)

    Lol, i just put in the original code which worked earlier. Now it doesnt O_O

    You are taking the code tags out, right?

    Thread Starter deaftone

    (@deaftone)

    LOL! I forgot to do that for the last 2 tries, but it’s up now.

    I’m using the latest piece of code you gave me:

    <?php
    $how_many=5; //How many posts do you want to show
    require_once('domains/news.deaf-monkey.com/html/wp-config.php'); // Change this for your path to wp-config.php file ?>
    
    <ul id="whats-new">
    <?
    $news=$wpdb->get_results("SELECT <code>ID</code>, <code>comment_count</code>, <code>post_date</code>,<code>post_title</code> FROM $wpdb->posts
    WHERE <code>post_type</code>=\"post\" AND <code>post_status</code>=\"publish\" ORDER BY post_date DESC LIMIT $how_many");
    foreach($news as $np){
    printf ("<li>%s <a href=\"http://news.deaf-monkey.com/index.php?p=%s\">%s</a> %s</li>", $np->post_date,$np->ID,$np->post_title,$np->comment_count);
    }?>
    </ul>

    It looks alot better than earlier, now i guess it’s the part where i need to customize it to look something like the mini loop that dreamten.com has. Just as i asked earlier, is this too difficult for a newbie or?

    Ok phew! I thought I was losing my mind

    Open a new thread and ask for help on formatting the date and i can help you after you get that fixed. I could figure the date thing out but I can’t test it and going back and forth is wearing me out. Better to find someone who actually knows how to do it..

    Good luck

    Thread Starter deaftone

    (@deaftone)

    Yeah, been a few hours now, hopefully someone gives some feedback to the other thread i made, the current mini loop is just horrid loll.

Viewing 9 replies - 16 through 24 (of 24 total)

The topic ‘Mini-loop’ is closed to new replies.