Support » Fixing WordPress » Need Help!

Viewing 15 replies - 16 through 30 (of 32 total)
  • Using the example in the codex (stripping out time and date)

    <ul class="commentlist">
    <?php wp_list_comments('type=comment&callback=mytheme_comment'); ?>
    </ul>

    and then in functions.php

    function mytheme_comment($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment; ?>
       <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
         <div id="comment-<?php comment_ID(); ?>">
          <div class="comment-author vcard">
             <?php echo get_avatar($comment,$size='48',$default='<path_to_url>' ); ?>
    
             <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
          </div>
          <?php if ($comment->comment_approved == '0') : ?>
             <em><?php _e('Your comment is awaiting moderation.') ?></em>
             <br />
          <?php endif; ?>
    
          <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s at %2$s')) ?></a><?php edit_comment_link(__('(Edit)'),'  ','') ?></div>
    
          <?php comment_text() ?>
    
          <div class="reply">
             <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
          </div>
         </div>
    <?php
            }

    See if this works for you.

    When I created the functions.php file with the code you listed above and added

    <ul class=”commentlist”>
    <?php wp_list_comments(‘type=comment&callback=mytheme_comment’); ?>

    I had to delete it due to an error and my site didn’t load.

    There is a lot of editing, if you could edit the original comments.php file and the functions.php file the way I need them I can just replace what I already have and it should work fine.

    As soon as I put in that functions.php code the site gets a syntax error.

    That’s because

    <?php wp_list_comments('type=comment&callback=mytheme_comment'); ?>

    goes in comments.php

    You already have it there, as

    <ol>
    <?php wp_list_comments(); ?>
    </ol>

    just change it into

    <ol>
    <?php wp_list_comments('type=comment&callback=mytheme_comment'); ?>
    </ol>

    only the functions part goes into functions.php

    try with this version (it includes what you already had in there):

    <?php
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Sidebar',
    'before_widget' => '<li class="widget">',
    'after_widget' => '</li>',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Subfoot Left',
    'before_widget' => '<li class="subfooter">',
    'after_widget' => '</li>',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Subfoot Center',
    'before_widget' => '<li class="subfooter">',
    'after_widget' => '</li>',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Subfoot Right',
    'before_widget' => '<li class="subfooter">',
    'after_widget' => '</li>',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));
    function mytheme_comment($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment; ?>
       <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
         <div id="comment-<?php comment_ID(); ?>">
          <div class="comment-author vcard">
             <?php echo get_avatar($comment,$size='48',$default='<path_to_url>' ); ?>
    
             <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
          </div>
          <?php if ($comment->comment_approved == '0') : ?>
             <em><?php _e('Your comment is awaiting moderation.') ?></em>
             <br />
          <?php endif; ?>
    
          <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s at %2$s')) ?></a><?php edit_comment_link(__('(Edit)'),'  ','') ?></div>
    
          <?php comment_text() ?>
    
          <div class="reply">
             <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
          </div>
         </div>
    <?php
            }
    ?>

    If that version of functions.php does not work, then try this version:

    <?php
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Sidebar',
    'before_widget' => '<li class="widget">',
    'after_widget' => '</li>',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Subfoot Left',
    'before_widget' => '<li class="subfooter">',
    'after_widget' => '</li>',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Subfoot Center',
    'before_widget' => '<li class="subfooter">',
    'after_widget' => '</li>',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Subfoot Right',
    'before_widget' => '<li class="subfooter">',
    'after_widget' => '</li>',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));
    ?>
    <?php
    function mytheme_comment($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment; ?>
       <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
         <div id="comment-<?php comment_ID(); ?>">
          <div class="comment-author vcard">
             <?php echo get_avatar($comment,$size='48',$default='<path_to_url>' ); ?>
    
             <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
          </div>
          <?php if ($comment->comment_approved == '0') : ?>
             <em><?php _e('Your comment is awaiting moderation.') ?></em>
             <br />
          <?php endif; ?>
    
          <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s at %2$s')) ?></a><?php edit_comment_link(__('(Edit)'),'  ','') ?></div>
    
          <?php comment_text() ?>
    
          <div class="reply">
             <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
          </div>
         </div>
    <?php
            }
    ?>

    Well it’s actually saving now but when I view the comments it says this

    trey says:

    Warning: printf() [function.printf]: Too few arguments in /home2/thesidet/public_html/wp-content/themes/unsleepable/functions.php on line 50
    (Edit)

    Spitta!

    Try if the full version (including date and time) works, then let’s go from there on how to edit them out. Maybe I made a mistake when I cut them out…

    <?php
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Sidebar',
    'before_widget' => '<li class="widget">',
    'after_widget' => '</li>',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Subfoot Left',
    'before_widget' => '<li class="subfooter">',
    'after_widget' => '</li>',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Subfoot Center',
    'before_widget' => '<li class="subfooter">',
    'after_widget' => '</li>',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));
    if ( function_exists('register_sidebar') )
    register_sidebar(array(
    'name' => 'Subfoot Right',
    'before_widget' => '<li class="subfooter">',
    'after_widget' => '</li>',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));
    ?>
    <?php
    function mytheme_comment($comment, $args, $depth) {
       $GLOBALS['comment'] = $comment; ?>
       <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
         <div id="comment-<?php comment_ID(); ?>">
          <div class="comment-author vcard">
             <?php echo get_avatar($comment,$size='48',$default='<path_to_url>' ); ?>
    
             <?php printf(__('<cite class="fn">%s</cite> <span class="says">says:</span>'), get_comment_author_link()) ?>
          </div>
          <?php if ($comment->comment_approved == '0') : ?>
             <em><?php _e('Your comment is awaiting moderation.') ?></em>
             <br />
          <?php endif; ?>
    
          <div class="comment-meta commentmetadata"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?></a><?php edit_comment_link(__('(Edit)'),'  ','') ?></div>
    
          <?php comment_text() ?>
    
          <div class="reply">
             <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
          </div>
         </div>
    <?php
            }
    ?>

    Right… and here was the mistake… from that last full version cut out
    <?php printf(__('%1$s at %2$s'), get_comment_date(), get_comment_time()) ?>

    Ya I got it now… really appreciate all your help man.

    http://thesidetracked.com/2009/08/meek-mill-dj-drama-announce-flamers-3-gangsta-grillz/

    Quick question, is there anyway to change the default gravatar picture or even make it so gravatars dont show up?

    Nevermind I found out how, thanks anway. Appreciate it all.

    Great, glad it worked out! 🙂

    I really don’t like this automated comments.php thing going on.. I like having the css & php at my fingertips to edit =]

    But yeah… how you think the site is looking and how is it functioning? It really doesn’t look like unsleepable at all =]

    You can style the comments through css, there is a whole section in your style sheet that should still work

    /* —- Begin Comment Styling —- */

    Site looks good to me!

Viewing 15 replies - 16 through 30 (of 32 total)
  • The topic ‘Need Help!’ is closed to new replies.