Tag Info

Hot answers tagged

3

You need to change the code you're using from <div class="post-meta"> <p><?php the_date(); ?> | <?php the_tags('tags:', ', ', '<br />'); ?> | <?php comments_number( $zero, $one, $more ); ?> comments</p> <?php comments_template(); ?> </div><!-- end post-meta --> to <div ...


2

Edit your comments.php template and add in <ol class="commentlist"> <?php wp_list_comments(); ?> </ol> This should display comments, pingbacks and trackbacks. See the Codex for wp_list_comments() for help on how to style and separate or to display just comments.


2

Check the Codex for wp_list_comments. Scroll down to the part labeled "Source File", which is there on almost every Codex entry. Click the accompanying link. And there you are. Sometimes (usually) the line number in the Codex entry is wrong though. Now you can happily go about hacking Core files and causing yourself no end of pain and heartache. If you ...


2

You could pull all of the comments by current user and loop over them to see how may where today or you can create a custom sql Query to select just the count of comments for the last 24 hours, something like this: global $wpdb,$current_user; $sql = $wpdb->prepare(" SELECT count(*) FROM wp_comments WHERE comment_author = '%s' AND ...


2

You are using comments_template which prints out the comments and returns nothing you need to capture the comments template so try this: function get_comments_template(){ ob_start(); comments_template(); return ob_get_clean(); } and change this line: $result .= comments_template(); //Append the comments template to the result to $result ...


2

You can use the get_comment_author_link hook, which is part of the get_comment_author_link() template tag, like your question already suggests. Then you only have to get the according user_id, which can be done via the $comment global, and construct the link you want accordingly. Exemplary usage like shown below: add_filter( 'get_comment_author_link', ...


1

You can use the provided filters to do all that: //add your checkbox after the comment field add_filter( 'comment_form_field_comment', 'my_comment_form_field_comment' ); function my_comment_form_field_comment( $comment_field ) { return $comment_field.'<input type="checkbox" name="privacy" value="privacy-key" class="privacyBox" ...


1

Yes, you're right, editing the core is not good. Here's one way to do it: add_action( 'comment_form', 'wpse_93795_comment_form' ); function wpse_93795_comment_form( $post_id ) { printf( '<span class="submit-comment-note">%s</span>', __( 'your message will only be visible after moderation', 'your_text_domain' ) ); } You can add this ...


1

You should not edit the Wordpress core files! If you have comment_id_fields() in your comments template, like this: <p class="form-submit"> <input name="submit" type="submit" id="<?php echo esc_attr( $args['id_submit'] ); ?>" value="<?php echo esc_attr( ...


1

Add style=ol to your call to wp_list_comments. Reference: http://codex.wordpress.org/Function_Reference/wp_list_comments#Parameters


1

Here's the working version, I referred the technique by @Bainternet to get it done. Just replace <?php comment_form(); ?> with this code <?php global $wpdb,$current_user; $limit = 5; //this is limit per day per user $comment_count = $wpdb->get_var( $wpdb->prepare(" SELECT count(*) FROM wp_comments WHERE ...


1

Note - It uses the values stored in global variable - wp_query. Usually the wp_query variable contains comments of current post when browsing. Usage - $comments = wpse61072_hide_admin_comment(5); // 5=max comments foreach ( $comments as $comment ) { echo '<li>'.$comment->comment_author.' - said : ...


1

Totally untested, but you should be able to use the pre_get_comments filter: function exclude_admin_comments($query) { $query->query_vars['user_id'] != 1; } add_action('pre_get_comments', 'exclude_admin_comments');


1

Yay! We got filters! Wrapping the result of the $wpdb comments query right into a filter callback (and a plugin) is the nice way of handling comments. /* Plugin Name: Ā»KaisersĀ« Comments without admin comments */ ! defined( 'ABSPATH' ) AND exit; add_filter( 'comments_array', 'wpse_61072_comments_without_admin', 20, 2 ); function ...


1

Try adding the following code to your comments.php template file (where you want the "next page" / "prev page" links displayed): <?php paginate_comments_links(); ?> This should enable multiple pages for your comments. Also, check out this Codex page (paginate_comments_links) for more information. Hope this helps ;)


1

get_comments(array( 'number' => 5, 'order' => 'desc' )) You will have to alter your template files and modify get_comments() function as above. Hope that helps.


1

Ended up solving this with the following code: <ol class="commentlist"> <?php $comments = array_reverse($comments, true); ?> <?php /* Loop through and list the comments. Tell wp_list_comments() * to use twentyten_comment() to format the comments. * If you want to overload ...


1

you need to replace $zero, $one, and $more with your own code; read the example in the Codex: http://codex.wordpress.org/Function_Reference/comments_number#Examples


1

This if statement is really wrong : if (get_current_user_id()==1 or get_current_user_id()==2 should be : $user_id = get_current_user_id(); if ($user_id==1 || $user_id==2 )


1

Just add the comments to oEmbed. Here's a small plugin that you can use as MU-Plugin or normal plugin and that should explain what's going on pretty well. <?php defined( 'ABSPATH' ) or exit; /* Plugin Name: (#105942) oEmbed Comments */ add_filter( 'comment_text', 'wpse_105942_oembed_comments', 0 ); function wpse_105942_oembed_comments( $comment ) { ...


1

A little late, but you could also add the following to your theme's functions.php file: /** Comment Form Function Defaults */ add_filter('comment_form_defaults','my_comment_defaults'); function my_comment_defaults($defaults) { global $user_identity, $id; if ( isset($post_id) ) $id = $post_id; else ...


1

In your functions.php add ( there are other rules relating to comment pages you can see them all with Rewrite Rules Inspector plugin, this one just covers the case you mention ) add_rewrite_rule ( '(.?.+?)/customname-([0-9]{1,})/?$', 'index.php?pagename=$matches[1]&cpage=$matches[2]', 'top' ); you'll also need to find in your theme ( possibly ...


1

When registering a custom post type you need to enable comments. In the arguments defining the CPT, you need to include something like this: 'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ) The example on the Codex is shows where this option needs to go, this page also shows a list of other options you may or may ...


1

to remove it from the left. Delete the line containing wp_list_comments from comments.php to display user name add comment_author();, for email use comment_author_email(); & for url use if(get_comment_author_url()) comment_author_url();. comment_text() is already there. These all go in the markup inside the function in functions.php


1

It depends on how your theme is built & we can't be 100% sure if this is right without seeing the code but most probably comments_template is the wrong function. Take a look at the comment_form function http://codex.wordpress.org/Function_Reference/comment_form comments_template is the function generally used to include the comments file(basically to ...


1

Fixed it already. I moved the entire code between and to single.php and only left comments.php to handle the comment field. Now I think about it, comments.php is a really weird place to put lay-out styles for share-links etc. Everybody else always puts it in the single.php.



Only top voted, non community-wiki answers of a minimum length are eligible