WordPress.org

Ready to get started?Download WordPress

Forums

Need Help! (33 posts)

  1. teckn1caLity
    Member
    Posted 4 years ago #

    http://thesidetracked.com/2009/11/chip-tha-ripper-fat-raps-ft-curreny-big-sean/

    If you see there is a comment there by "trey".
    I want to take out the code that says when it was commented and I can't seem to find it anyway. Any guidance will be appreciated.

  2. buddha trance
    Member
    Posted 4 years ago #

    Look in your theme files for comments.php or comments-something.php
    (in the Default theme it's in comments-popup.php) for something like

    <?php comment_date('M jS, Y'); ?> at <?php comment_time(); ?>

    and edit it out.

  3. teckn1caLity
    Member
    Posted 4 years ago #

    <?php // Do not delete these lines
    if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    	die ('Please do not load this page directly. Thanks!');
    if ( post_password_required() ) { ?>
    	<p class="center"><?php _e("This post is password protected. Enter the password to view comments."); ?></p>
    <?php
    	return;
    } ?>
    
    <!-- You can start editing here -->
    
    <div id="comments-list">
    
    <?php if ( have_comments() ) : ?>
    	<h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3>
    
    	<ol>
    	<?php wp_list_comments(); ?>
    	</ol>
    
     <?php else : // this is displayed if there are no comments so far ?>
    
    	<?php if ('open' == $post->comment_status) : ?>
    		<!-- If comments are open, but there are no comments. -->
    
    	 <?php else : // comments are closed ?>
    		<!-- If comments are closed. -->
    		<p class="nocomments">Comments are closed.</p>
    
    	<?php endif; ?>
    <?php endif; ?>
    
    <?php if ('open' == $post->comment_status) : ?>
    
    <div id="respond">
    
    <h3><?php comment_form_title( 'Leave a Reply', 'Leave a Reply to %s' ); ?></h3>
    
    <div class="cancel-comment-reply">
    	<small><?php cancel_comment_reply_link(); ?></small>
    </div>
    
    <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
    <p>You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in</a> to post a comment.</p>
    <?php else : ?>
    
    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    
    <?php if ( $user_ID ) : ?>
    
    <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out &raquo;</a></p>
    
    <?php else : ?>
    
    <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
    <label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label></p>
    
    <p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
    <label for="email"><small>Mail (will not be published) <?php if ($req) echo "(required)"; ?></small></label></p>
    
    <p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
    <label for="url"><small>Website</small></label></p>
    
    <?php endif; ?>
    
    <!--<p><small><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?></code></small></p>-->
    
    <p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p>
    
    <p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
    <?php comment_id_fields(); ?>
    </p>
    <?php do_action('comment_form', $post->ID); ?>
    
    </form>
    
    <?php endif; // If registration required and not logged in ?>
    </div>
    
    <?php endif; // if you delete this the sky will fall on your head ?>

    This is all that's in my comments.php file..I can't find anything to edit.

  4. buddha trance
    Member
    Posted 4 years ago #

    In the "unsleepable" theme that you have, I see this part in comments.php (I downloaded both the original and the widget-ready version):

    on <a href="#comment-<?php comment_ID() ?>" title="<?php if (function_exists('time_since')) { $comment_datetime = strtotime($comment->comment_date); echo time_since($comment_datetime) ?> ago<?php } else { ?>Permalink to Comment<?php } ?>"><?php comment_date('M jS, Y') ?></a>

    If you are using a different version, could you point me out to the download link?

  5. teckn1caLity
    Member
    Posted 4 years ago #

    I'm using Unsleepable 3.0 by Ben Gray and I have no touched the comments.php file before.

    No, I do not see that line of code though buddha.

  6. esmi
    Forum Moderator
    Posted 4 years ago #

    <?php wp_list_comments(); ?> is generating the comment list code.

    http://codex.wordpress.org/Template_Tags/wp_list_comments

  7. teckn1caLity
    Member
    Posted 4 years ago #

    Okay that's one thing I'm not good with. Could one of you give me the line of php wp_list_comments without it displaying the date? Would be hella appreciated.

  8. buddha trance
    Member
    Posted 4 years ago #

    If you check the link that esmi provided, there is a reference to functions.php of the theme.

    "You will need to define your custom callback function in your theme's functions.php file."

    Check in there, and edit out the reference to the date and time. In the codex example:

    get_comment_date(), get_comment_time()

    In the Default theme, there is the same call for wp_list_comments in comments.php, but that callback function is in comments-popup.php, so, if it's not in functions.php, look for another file comments-whatever.php, as mentioned earlier.

  9. buddha trance
    Member
    Posted 4 years ago #

    I forgot to mention that Unsleepable 3.0 cannot be downloaded. On the author's site it gives a 404 not found. I tried searching for it on Google, but all links to the last version of this theme are broken.

  10. teckn1caLity
    Member
    Posted 4 years ago #

    I guess I got an exclusive huh buddha =]

    But how do you think the site looks? been doing alot of work on it.

  11. teckn1caLity
    Member
    Posted 4 years ago #

    buddha I actually have the default unsleepable 3.0 theme on my computer if you want me to upload it for you. I always keep a copy for backup =]

    Edit: I dont have a functions.php file in my unsleepable theme folder.

  12. buddha trance
    Member
    Posted 4 years ago #

    Yes, upload a zipped file so I can look at it to see if I can locate the code. I'll check back shortly for the url.

  13. teckn1caLity
    Member
    Posted 4 years ago #

  14. buddha trance
    Member
    Posted 4 years ago #

    Hmmm... you are right, there is no other reference than the call to wp_list_comments...

    Let me search for info on how to make changes, unless someone else jumps in with the know-how.

  15. teckn1caLity
    Member
    Posted 4 years ago #

    Alright appreciate it but don't forget about me!

  16. buddha trance
    Member
    Posted 4 years ago #

    OK, it looks like you can do it by adding a callback to wp_list_comments, and add that callback to functions.php (which is what the link esmi gave earlier, also mentions)

    Read this for reference as well
    http://www.kimwoodbridge.com/how-to-remove-says-from-wordpress-27-threaded-comments/

    http://www.scriptygoddess.com/archives/2009/01/15/wordpress-wp_list_comments/

    So use instead
    <?php wp_list_comments('callback=mytheme_comment'); ?>

    and then add the mytheme_comment function into functions.php, following the examples given, and skip the time and date part.

    Hope this helps!

  17. buddha trance
    Member
    Posted 4 years ago #

    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.

  18. teckn1caLity
    Member
    Posted 4 years ago #

    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.

  19. teckn1caLity
    Member
    Posted 4 years ago #

    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.

  20. teckn1caLity
    Member
    Posted 4 years ago #

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

  21. buddha trance
    Member
    Posted 4 years ago #

    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
            }
    ?>
  22. buddha trance
    Member
    Posted 4 years ago #

    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
            }
    ?>
  23. teckn1caLity
    Member
    Posted 4 years ago #

    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!

  24. buddha trance
    Member
    Posted 4 years ago #

    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
            }
    ?>
  25. buddha trance
    Member
    Posted 4 years ago #

    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()) ?>

  26. teckn1caLity
    Member
    Posted 4 years ago #

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

  27. teckn1caLity
    Member
    Posted 4 years ago #

    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?

  28. teckn1caLity
    Member
    Posted 4 years ago #

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

  29. buddha trance
    Member
    Posted 4 years ago #

    Great, glad it worked out! :-)

  30. teckn1caLity
    Member
    Posted 4 years ago #

    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 =]

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags