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.

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

Answers


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>';

Need Your Help

How To Print ASCII Extended Characters Using a Const Char*?

c variables bios vga extended-ascii

I have a function to print characters on the screen that is like this:

JavaFX: Content from ObservableArrayList gets loaded (probably) but not shown

java javafx tableview

I have created a little program that is supposed to load data from a database and display it in a TableView element in a JavaFX application.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.