Enlightenment – Leave a comment or reply

Viewing 7 posts - 1 through 7 (of 7 total)
  • #21562
    DavidMR
    Participant

    Hello, I am using the Enlightenment theme and I’d like to add a “Leave a Comment” or “Leave a Reply” link on each post, preferably at the bottom. As it stands now, “Leave a Reply” only shows up on a single post page, but I’d like it on the main/blog page otherwise it is difficult for readers to figure out how to leave a comment (by clicking No/# Comments on the post header).

    I’ve searched your forum and found code for the Pinboard theme to be placed in functions.php, but I can’t see where to put it in the Enlightenment functions.php. Is there some code I could place in custom css?

    BTW, this is an awesome theme. The one I was using for five years wasn’t too mobile friendly. After testing some 20 or so other themes, I found yours – the only theme that actually does what it says it can do!

    Thanks in advance for any help. My blog is theendlessfurther.com

    • This topic was modified 8 years, 9 months ago by DavidMR.
    #21564
    Daniel Tara
    Keymaster

    Currently the theme does add a “Leave a comment” link to each post at the bottom, but it’s labeled as “No Comments” instead of “Leave a comment”. If you would like to change the label, add this code to your child theme’s functions.php file:

    add_filter( 'enlightenment_comments_link_args', 'enlightenment_child_filter_comments_link_args', 12 );
    
    function enlightenment_child_filter_comments_link_args( $args ) {
      	$args['format']['zero'] = __( 'Leave a comment', 'enlightenment-child' );
      	return $args;
    }

    Alternatively if you would like the label to be “Leave a comment” regardless of the number of comments, add this code instead:

    add_filter( 'enlightenment_comments_link_args', 'enlightenment_child_filter_comments_link_args', 12 );
    
    function enlightenment_child_filter_comments_link_args( $args ) {
      	$args['format']['zero'] = __( 'Leave a comment', 'enlightenment-child' );
      	$args['format']['one']  = __( 'Leave a comment', 'enlightenment-child' );
      	$args['format']['more'] = __( 'Leave a comment', 'enlightenment-child' );
      	return $args;
    }
    #21566
    DavidMR
    Participant

    Daniel, thanks for the quick reply. I don’t see “No Comments” at the bottom, rather it appears at the top under the post title. That position is fine, I guess. But – this no doubt will make you groan – I don’t use a child theme. I make very few modifications directly to the theme – this would probably be the only one and I will note it in case it’s lost after an upgrade. That’s why I like themes with “theme options” and a custom css utility.

    So what code would I use on the actual theme’s functions.php file? Sorry to be a pain . . .

    #21567
    DavidMR
    Participant

    One more thing, what I’m talking about is on the blog page – I don’t use excerpts but show the full post and it’s on infinite scroll so they go on forever. I don’t want to change the top where it says “No Comments” or “4 Comments” etc. I just need something else either top or bottom that visitors can click on to leave a comment. Most of them would not know how otherwise. Thanks.

    #21569
    Daniel Tara
    Keymaster

    Here’s the code to display the link in the post’s footer:

    add_action( 'wp', 'enlightenment_child_wp_actions', 20 );
    
    function enlightenment_child_wp_actions( $args ) {
      if( ! is_singular() ) {
        add_action( 'enlightenment_entry_footer', 'enlightenment_entry_meta' );
      }
    }
    
    add_filter( 'enlightenment_comments_link_args', 'enlightenment_child_filter_comments_link_args', 12 );
    
    function enlightenment_child_filter_comments_link_args( $args ) {
      if( is_singular() || 'post' != get_post_type() ) {
        return $args;
      }
      
      if( doing_action( 'enlightenment_entry_footer' ) ) {
        	$args['format']['zero'] = __( 'Leave a comment', 'enlightenment-child' );
        	$args['format']['one']  = __( 'Leave a comment', 'enlightenment-child' );
        	$args['format']['more'] = __( 'Leave a comment', 'enlightenment-child' );
      }
      return $args;
    }

    Wether you use a child theme or not is your choice. The code needs to go in the functions.php file. I prefixed them with enlightenment_child so their names don’t conflict with existing functions.

    Later edit: You also need to add this bit of code:

    add_filter( 'enlightenment_entry_meta_args', 'enlightenment_child_filter_entry_meta_args', 12 );
    
    function enlightenment_child_filter_entry_meta_args( $args ) {
      if( is_singular() || 'post' != get_post_type() ) {
        return $args;
      }
      
      if( doing_action( 'enlightenment_entry_footer' ) ) {
        $args['format'] = '%5$s';
      }
      return $args;
    }
    #21571
    DavidMR
    Participant

    I couldn’t tell from your reply if the code you gave would work ONLY on a child theme, and I didn’t see the later edit until later. I thought I would insert the code anyway, and now the entire site is broke and I have no clue as to how fix it. Here is the error msg:

    Parse error: syntax error, unexpected $end in /home/theendle/public_html/wp-content/themes/enlightenment/functions.php on line 1083

    My later edit:

    I downloaded the theme to my hard drive and replaced the functions file and fixed it. Thanks, I think I will leave it as is, hopefully people will smart enough to figure out how to leave comments.

    • This reply was modified 8 years, 9 months ago by DavidMR.
    #23050
    admitcard
    Participant

    hey there i try to change it from replay to leave a comment but nothings seems to be working on my website. admitcard

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

Tagged: 

You must be logged in to reply to this topic.