How to Remove Link from Comment Date

Community Forums Forums Design Tips and Tricks How to Remove Link from Comment Date

This topic is: not resolved

Tagged: 

This topic contains 8 replies, has 2 voices, and was last updated by  rfmeier 1 year, 5 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #43999

    RobBerger
    Participant
    Post count: 6

    I’ve searched the forum on this but haven’t found anything that answers the question.  I’m using Genesis/Dynamik and noticed that the date to every comment contains a link to that comment.  Not sure what use that would serve, but I’d like to remove the link.  Any help would be greatly appreciated.

    http://www.doughroller.net/credit/how-can-your-credit-repor-affect-your-ability-to-get-hired/
    #44001

    rfmeier
    Participant
    Post count: 603

    Hello,

    Looking at the Genesis source, as I don’t have the Dynamik theme, a filter will need to be created to target a new custom comment callback.  The new custom comment callback is used to display each comment within the comment loop.  I created a gist that would go within your functions.php.  As I said before, I do not have the Dynamik theme, so I am not sure if that theme is using a custom comment callback of it’s own.

    I hope this helps or points you in the right direction.


    #44003

    RobBerger
    Participant
    Post count: 6

    Ryan, thanks for the detailed response.  I confess, however, that I was hoping for something a little less complicated.  But maybe there is no easy way to remove the link.

    #44004

    rfmeier
    Participant
    Post count: 603

    Unfortunately, I did not see any options or filters to adjust this within the source.  There may be another way to do this, but it would still require back-end code.  This code actually could be turned into a plugin, but that would require some more work.

    Someone feel free to chime in if they know a better solution.


    #44358

    RobBerger
    Participant
    Post count: 6

    Ryan, can this code be used with Simple Hooks?  I’m sure I’m doing something wrong, but I added it to `genesis_list_comments` Hook, checked the unhook and php boxes, but got the following error:

    Parse error: syntax error, unexpected ‘<‘ in /nas/wp/www/staging/doughroller/wp-content/plugins/genesis-simple-hooks/plugin.php(126) : eval()’d code on line 33

    #44359

    rfmeier
    Participant
    Post count: 603

    I had this in my functions.php file for testing. I would have to try this out with Simple Hooks yet. Let me give it a quick try and I will get back to you.


    #44363

    rfmeier
    Participant
    Post count: 603

    To my surprise it worked with Genesis Simple Hooks. I did have to change some of the code. Here is was I entered;

    [php]
    <?php

    $args = array(
    ‘type’ => ‘comment’,
    ‘avatar_size’ => 48,
    ‘callback’ => ‘genesis_comment_callback’,
    );

    // set out custom function
    $args[‘callback’] = ‘custom_genesis_comment_callback';

    $args = apply_filters( ‘genesis_comment_list_args’, $args );

    wp_list_comments( $args );

    function custom_genesis_comment_callback( $comment, $args, $depth ){

    $GLOBALS[‘comment’] = $comment; ?>

    <li <?php comment_class(); ?> id="comment-<?php comment_ID(); ?>">

    <?php do_action( ‘genesis_before_comment’ ); ?>

    <div class="comment-header">
    <div class="comment-author vcard">
    <?php echo get_avatar( $comment, $size = $args[‘avatar_size’] ); ?>
    <?php printf( __( ‘<cite class="fn">%s</cite> <span class="says">%s:</span>’, ‘genesis’ ), get_comment_author_link(), apply_filters( ‘comment_author_says_text’, __( ‘says’, ‘genesis’ ) ) ); ?>
    </div><!– end .comment-author –>

    <div class="comment-meta commentmetadata">
    <?php //** Comment date removed ** ?>
    <span><?php printf( __( ‘%1$s at %2$s’, ‘genesis’ ), get_comment_date(), get_comment_time() ); ?></span>
    <?php edit_comment_link( __( ‘(Edit)’, ‘genesis’ ), ” ); ?>
    </div><!– end .comment-meta –>
    </div>

    <div class="comment-content">
    <?php if ( $comment->comment_approved == ‘0’ ) : ?>
    <p class="alert"><?php echo apply_filters( ‘genesis_comment_awaiting_moderation’, __( ‘Your comment is awaiting moderation.’, ‘genesis’ ) ); ?></p>
    <?php endif; ?>

    <?php comment_text(); ?>
    </div><!– end .comment-content –>

    <div class="reply">
    <?php comment_reply_link( array_merge( $args, array( ‘depth’ => $depth, ‘max_depth’ => $args[‘max_depth’] ) ) ); ?>
    </div>

    <?php do_action( ‘genesis_after_comment’ );

    /** No ending </li> tag because of comment threading */

    }

    ?>
    [/php]

    Note: Make sure to check the following;

    Unhook genesis_default_list_comments() function from this hook?
    Execute PHP on this hook?

    Also: Make sure to begin it with [php]<?php[/php] and end with [php]?>[/php]

    I hope this helps.


    • This reply was modified 1 year, 5 months ago by  rfmeier.
    • This reply was modified 1 year, 5 months ago by  rfmeier.
    #44366

    RobBerger
    Participant
    Post count: 6

    Worked like a charm!  Very much appreciate your help.

    #44367

    rfmeier
    Participant
    Post count: 603

    You are welcome. I am glad I could help.


Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.