What's the code for recent coments

Discussion in 'WordPress' started by Steupz, May 20, 2008.

  1. #1
    I want to use my sidebar.php for my theme and not the built in wordpress widgets because it gives me greater control of the sidebar.

    But the reason I am not using it is because I cannot get the most recent comments to work.
    Is there anyone out there who knows the code to call on it.

    For example, I can grab the links using:
    <?php wp_list_bookmarks('title_before=<h2>&title_after=</h2>'); ?>
    PHP:
    But what do I need to get the recent comments. Again, I don't want to use the built in widgets because I want to add pics and stuff to my sidebar.
    I am using WP 2.51
     
    Steupz, May 20, 2008 IP
  2. mizaks

    mizaks Well-Known Member

    Messages:
    2,066
    Likes Received:
    126
    Best Answers:
    0
    Trophy Points:
    135
    #2
    mizaks, May 20, 2008 IP
  3. Steupz

    Steupz Peon

    Messages:
    917
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks Mizaks; I was hoping to avoid another plugin, but it seems like it might be the only way.

    I did find code I'll try first.

    Here it is for anyone else who may need it:
    
    <?php if (function_exists('get_recent_comments')) { ?>
       <li><h2><?php _e('Recent Comments:'); ?></h2>
            <ul>
            <?php get_recent_comments(); ?>
            </ul>
       </li>
       <?php } ?>
    PHP:
     
    Steupz, May 20, 2008 IP
  4. metrox

    metrox Active Member

    Messages:
    88
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    93
    #4
    This function is a part of a plugin.
    It won't work without it.
    You can safely install this plugin, it has been tested on many blogs.
     
    metrox, May 20, 2008 IP
  5. Steupz

    Steupz Peon

    Messages:
    917
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I undestand what you're saying; but if recent comments is already part of wordpress; there must be a way to call it with code rather than using all widgets.
    There has to be
     
    Steupz, May 20, 2008 IP
  6. metrox

    metrox Active Member

    Messages:
    88
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    93
    #6
    It is not. This is why this plugin exist.
     
    metrox, May 20, 2008 IP