Comment button wordpress

I’m editing my website for add a comment button and view comments button.

I call the PHP wordpress function but don’t work.

Read More

I’m adding the button in place of Jetpack sharedaddy module.

This is the code:

$sharing_content .='<a style="margin-left:2px; font-weight:bold;" class ="comentar" href="<?php comments_link(); ?>">Add a comment</a>';

$sharing_content .='<a style="margin-left:5px; font-weight:bold;" class ="comentar" href="<?php wp_list_comments(); ?>">View comments</a>';

The includes of the php module:

include_once dirname( __FILE__ ).'/sharing-sources.php';

I think that dont run because I have not added the include of the php wordpress function.

Any help? :-S

Related posts

Leave a Reply

1 comment

  1. 2 issues – Your syntax is incorrect in that you shouldn’t be using the PHP opening and closing tags, you are adding to the the variable $sharing_content so your syntax should be;

    $sharing_content .='<a style="margin-left:2px; font-weight:bold;" class ="comentar" href="'. comments_link() .'">Add a comment</a>';
    

    The first link to the comments for the current post should work. However, your second link won’t work at all, you’ve just stuck wp_list_comments(); in as the href value. wp_list_comments(); would be used to display all the comments of the current post in a template, not to link to them. I’d suggest that your href value should be the post’s url, the comments will be viewable there;

    $sharing_content .= '<a style="margin-left:5px; font-weight:bold;" class ="comentar" href="'. the_permalink() .'">View comments</a>';