add comment count
-
Hi Ajay,
Thanks for your response and apologies for not posting my query here in the first place.
So I’d like to add a comment count to your plugin. So far I’ve amended the top-10.php file to include the following lines which show up in the Admin fine, I can select the option, but it’s not outputting on the front end correctly:
line 448:
if ($show_comments) { $output .= '<span class="tptn_comments"> '.comments_number( '0', '1', '%' ).'</span>';
line 538:
$show_comments = isset($instance['show_comments']) ? esc_attr($instance['show_comments']) : '';
line 586:
<p> <label for="<?php echo $this->get_field_id('show_comments'); ?>"> <input id="<?php echo $this->get_field_id('show_comments'); ?>" name="<?php echo $this->get_field_name('show_comments'); ?>" type="checkbox" <?php if ($show_comments) echo 'checked="checked"' ?> /> <?php _e(' Show comments?', TPTN_LOCAL_NAME); ?> </label> </p>
line 622:
$instance['show_comments'] = ($new_instance['show_comments']);
line 658:
'show_comments' => $instance['show_comments'],
line 675:
'show_comments' => $instance['show_comments'],
line 789:
'show_comments' => false, // Show comments in list item'
I’d also be happy to just hardcode the comment counter in there (without the if statement), instead of making it a selectable option, so I tried the following on line 448 but again, I’m clearly doing something wrong as it’s not outputting correctly:
$output .= '<span class="tptn_comments">'.comments_number( '0', '1', '%' ).'</span> ';
Your help would be great.
Many thanks
Katri
- The topic ‘add comment count’ is closed to new replies.