WordPress.org

Ready to get started?Download WordPress

Forums

comments in pages (11 posts)

  1. parfumio
    Member
    Posted 3 years ago #

    My site is http://www.parfumio.ro/

    I had a problem with my comments, they were not shown in my pages, only in my posts.
    I have solved this by adding <?php comments_template(); ?> in page.php

    But now I need help for something:
    I want to hide the comments from certain pages. Is there a way to exclude some pages from showing the comments? For example, I want to hide the comments from http://www.parfumio.ro/ and http://www.parfumio.ro/oferta-speciala/
    What should I do?

    Thanks in advance.
    [ Larry ]

  2. Edit the page and look for the comments and trackbacks settings within. Turn the comments off. Click save. Done :)

    Have a beer,

  3. Thejas Kamath
    Member
    Posted 3 years ago #

    Instead of entering just <?php comments_template(); ?> in page.php, try to paste the code which I have added up below.

    <?php comments_template('exclude=enter the page id here'); ?>

    Thanks

  4. Yeah, but they you have to update that every time you want to exclude a new page. By turning off comments per page, you get more flexibility. Easier to change your mind later, too :)

  5. Thejas Kamath
    Member
    Posted 3 years ago #

    @ipstenu,

    You are absolutely right!

  6. parfumio
    Member
    Posted 3 years ago #

    Thanks a lot to both of you.
    I've implemented these suggestions yesterday and they seem to work but, oddly enough, only on some of the pages (?!?).

    For example, page http://www.parfumio.ro/oferta-speciala/
    The ID is 254.
    I included the 'exclude' comand in the code like this
    <?php comments_template('exclude=254,344,642,970,1059,2545,3261'); ?>
    I also unchecked "allow comments" from the page admin.
    Well, it doesn't work! That page still shows the old comments and allows new ones... What could it be?

    On the othe hand, my main page (http://www.parfumio.ro/) has the ID 2545 and the comments nicely disappeared... Like I said, very odd..

    2.
    I have another question, please..
    When a comment is posted (to the pages where I allow that) I want the IP of the commenter to be shown. What do I have to do? Do you have any idea?

  7. Thejas Kamath
    Member
    Posted 3 years ago #

    @parfumio, Publishing IP address on blogs sounds like Spam. I suggest you not to do it.

  8. parfumio
    Member
    Posted 3 years ago #

    Thejas, thanks for your comment, I thought so too.
    But the comments of my clients would bring more credibility to my business and the problem is that some people think that I posted those comment myself. That's why I thought to showing the IPs of the commenters.
    On the other hand I think almost everyone knows that the IP is public over the internet. So why should it be considered spam?

  9. parfumio
    Member
    Posted 3 years ago #

    What about the other issue? Why do the comments still show in some pages even if I disabled them? Do you have any idea what I shoud do?

  10. Thejas Kamath
    Member
    Posted 3 years ago #

    Hey If you wanna add comments in index.php, you must add the code in index.php file. If you add the code in page.php file, how comments will appear in index.php (ie, your site homepage).

    Thanks

  11. parfumio
    Member
    Posted 3 years ago #

    Hi

    I tried to understand your answer but I guess I'm missing something..
    I still don't know what should I do in order to hide the comments from certain pages.

    You suggested to add <?php comments_template('exclude=enter the page id here'); ?> and so I did.
    Let's take an example:
    The page http://www.parfumio.ro/contact/ (ID=344) is ok, the comments are closed and the ones added before are not shown.
    But the page http://www.parfumio.ro/oferta-speciala/ (ID=254) still shows comments and allows new ones.
    Both ID 254 and 344 are excluded as you told me.

    Why is that and what should I do?

    I tried to add <?php comments_template('exclude=enter the page id here'); ?> in index.php too but it didn't work. Probably I didn't add it where I was supposed to add it..

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic