WordPress.org

Ready to get started?Download WordPress

Forums

Insert PHP
[resolved] Works but cannot remove comments (17 posts)

  1. kamaleon
    Member
    Posted 1 year ago #

    I tried to remove comments from a page using php and there is still the form to add a comment. As soon as I remove the php code, the comments are also removed.

    Is there a way to use your plugin and disable comments on the page?

    Thank you

    http://wordpress.org/extend/plugins/insert-php/

  2. WillBontrager
    Member
    Plugin Author

    Posted 1 year ago #

    Perhaps I don't understand the question.

    Try using the WordPress Dashboard to remove comments.

    Will

  3. kamaleon
    Member
    Posted 1 year ago #

    I don't get what you mean...

  4. WillBontrager
    Member
    Plugin Author

    Posted 1 year ago #

    Log into your WordPress admin Dashboard.

    In the menu on the left-hand side of the page, click on "Comments." You can remove comments there.

    Will

  5. kamaleon
    Member
    Posted 1 year ago #

    I want a page with no comments at all. I don't want to delete them. From the beginning, a page with the comments disabled. You do that by unchecking the comments at the bottom of a page or a post. I already did that, but when there is php in that page (with your plugin), the option to comment does not disappear.

    Are you getting me?

  6. WillBontrager
    Member
    Plugin Author

    Posted 1 year ago #

    Let's first make sure the settings are like they're supposed to be.

    In the Dashboard, in "Settings | Discussion," verify the settings specifically won't allow comments.

    If you still see the option to comment when the Insert PHP plugin is used, and not when it is removed, then post the entire code you're using. I'll see what I can see.

    Will

  7. kamaleon
    Member
    Posted 1 year ago #

    I want comments in some posts, and I don't want comments in other posts... So I cannot disable it from "Settings | Discussion," as you say. I have to do it in a post by post (or page) basis.

    Create a new page and add this code from your webpage and try disabling comments on this page:

    hello this is a test

    [insert_php]
    echo 'Server date and time is: ';
    echo date('l, F j, Y \a\t G:i:s');
    [/insert_php]

  8. WillBontrager
    Member
    Plugin Author

    Posted 1 year ago #

    I need a bit of help, as I really want to duplicate this issue.

    The installation is 3.5.1 and comments are turned on. I have two posts. One is with the Inert PHP and the other without.

    I'm going to post the two URLs, see if the system will allow it.

    http://affinityseries.com/wp351/?p=17

    http://affinityseries.com/wp351/?p=23

    What I can't figure out is how to turn comments off for an individual page. And I need to do that to duplicate the issue.

    Any pointers?

    Will

  9. kamaleon
    Member
    Posted 1 year ago #

    Here you go

    http://www.youtube.com/watch?v=zD08CkyaZYw

    try with comments instead of discussion

  10. WillBontrager
    Member
    Plugin Author

    Posted 1 year ago #

    This is a bit frustrating :)

    I have two posts (URLs above) and two pages:

    http://affinityseries.com/wp351/?page_id=14

    http://affinityseries.com/wp351/?page_id=30

    One of the posts has the Insert PHP code and the other does not. Same with the pages, one has it and the other now.

    The site has comments turned on. The four pages have their individual comments turned off.

    No comment box appears whether or not the Insert PHP code is on the post or page.

    I'm using version 1.1 of Insert PHP. It had a bug fix. If you're using 1.0, try upgrading and see if the issue disappears.

    Will

  11. kamaleon
    Member
    Posted 1 year ago #

    I have the version from the wordpress repository...

  12. kamaleon
    Member
    Posted 1 year ago #

    It is version 1.1

  13. WillBontrager
    Member
    Plugin Author

    Posted 1 year ago #

    I'm sorry I'm unable to duplicate the issue.

    My thought is to just not use Insert PHP, for now, while it is interfering with things. I'll cogitate on it and maybe figure out a way to duplicate it so I can investigate.

    Sorry I'm unable to help you right now.

    Will

  14. kamaleon
    Member
    Posted 1 year ago #

    I will try it on an empty wordpress to check if it is working...

  15. kamaleon
    Member
    Posted 1 year ago #

    Can you try with this code? Changing the include=5 with a category number that you have... It lists all the posts in a category

    $cats = get_categories('include=5');
    foreach ($cats as $cat) {
      echo "
    <ul>";
      $custom_loop = new WP_Query('posts_per_page=-1&cat='.$cat->cat_ID);
      while($custom_loop->have_posts()) {
        $custom_loop->the_post();
        $category = get_the_category();
        // Only display a post link once, even if it's in multiple categories
        if ($category[0]->cat_ID == $cat->cat_ID) {
          echo '
    <li><a href="'.get_permalink().'">'.get_the_title().'</a></li>
    ';
        }
      }
      echo "</ul>
    ";
    }
  16. kamaleon
    Member
    Posted 1 year ago #

    I fixed it by adding this at the end

    wp_reset_query();

    before closing the php section and now it works :)

  17. WillBontrager
    Member
    Plugin Author

    Posted 1 year ago #

    kamaleon, you're a genius.

    I'll surely remember that fix.

    Will

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.