The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Comments Link Not Working PHP help (2 posts)

  1. couponverve
    Posted 4 years ago #

    This is my first wordpress support post. I tried to search for an answer before posting but couldn't find one.

    my blog blog.couponverve.com i just installed the facebook comment app. however i'm having trouble making a comment link in my social media bar at the end of my blog post. I got it to show "0 Comments" but I need to be able to link that so it goes to the full blog posts and readers can see where to comment.

    i'm a novice at PHP - but I think it has something to do with my coding there... i'm just looking for some assistance with inserting a proper code to get my comment section to work. Thanks

  2. Marventus
    Posted 4 years ago #

    Basically, what you want to use for that is an anchor link.
    If you place a paragraph right before your Facebook iframe (where your comments appear) and assign it an ID, you can then link to that particular paragraph from anywhere on the site. This is what it should like approximately:

    <div style="width:90px;padding-right:10px; margin:4px 4px 4px 4px;height:30px;">
    <!-- New paragraph below -->
    <p id="comments">Comments:</p>
    <iframe ...>

    Then, if you were to create a link to that paragraph from somewhere else inside the same page, you would use # (pound symbol) + the id of the paragraph (in this case, comments):

    <a id="comment-link" href="#comments">Link to comments</a>

    If you are linking from outside of the page, the href value would have to include the domain name and the page URL as well:


    Here is a JSFiddle where you can test links inside the same page. I already made you one. Just click on "Link to Comments".

    To implement this in your template, you have to modify your index.php file to add the anchor to all your comment links, and your single.php file to add the paragraph with the corresponding unique ID.

Topic Closed

This topic has been closed to new replies.

About this Topic