Support » Fixing WordPress » wordpress comments

  • I have a question, on my site how do I get the add comment part at the bottom of each entry on my wordpress to show up so people can post comments? I’ve tried putting this code in my index page but it never works:

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    <table width=”99%” border=”0″ cellspacing=”0″ cellpadding=”0″ style=”margin-bottom:16px;”>
    <?php the_content(‘Read the rest of this entry »’); ?></td>
    Posted on <span style=”color:#000000;”><?php the_time(‘d M Y’) ?></span> by <span style=”color:#000000;”><?php the_author() ?></span> || <span style=”color:#0000000;”><?php comments_popup_link(‘No Comments’, ‘1 Comment’, ‘% Comments’); ?></span></td>

    <?php endwhile; ?>

    <p align=”center”><?php next_posts_link(‘« Older Entries |’) ?><?php previous_posts_link(‘| Newer Entries »’) ?>

    <?php else : ?>

    <p align=”center”>Sorry, but you are looking for something that isn’t here.</p>

    <?php endif; ?>

    Thanks for any help you can give, and if you can’t help me can you maybe tell me of someone who can, I’ve been trying to figure this out for days. Thanks!

Viewing 9 replies - 1 through 9 (of 9 total)
  • It looks like you need to add this line right after your table close:
    <?php comments_template(); ?>

    I’m not sure why you have a table structure, but if you are going to use it, you need open cell
    tags in two places.

    thanks for replying! I tried that and I just got Fatal error: Call to undefined function comments_popup_link()

    Can you post the whole error message?

    now I’m getting: Fatal error: Call to undefined function have_posts() in /home/katelynt/public_html/index.php on line 74

    line 74 is this: <?php if (have_posts()) : ?>

    and its throwing off my whole sidebar now. this is so annoying! I really appreciate your help though. I had no idea wordpress would be so complicated.

    That’s right at the start of your loop, and since you are showing some posts, I’m confused.

    Is this a brand new installation of WordPress? Are you sure you installed everything? Without seeing your code, I can’t say why a function would suddenly go undefined. Most likely all of these “missing” functions are in a folder called wp-includes

    I notice that you are missing quite a few things in this index file that you probably need. Have you looked in the codex at the theme development articles they have there?
    Try this one

    and this one has a list of step by step articles.

    It might be best at this point to take a look at those, and re-work your index.php file.

    Thanks for the info! I’m pretty new at using wordpress so I’m probably doing something wrong, I just don’t know what.

    My host has a thing called Fantastico De Luxe that automatically installed wordpress for me so I’m pretty sure it was installed right.

    This is what I was using to display my blog on my website:

    Plus the code I showed you before, thats basically the whole code on my index page. If you have anymore ideas as to whats wrong please let me know.

    Thanks so much!!

    I’m not a big fan of this approach. Also, check on the version that you got from your host. Chances are it needs upgrading, they don’t get a new version very often in general. I think if it is less than 2.3.3, you really want to consider an upgrade.

    If you want to put your WordPress software in a sub-directory (recommended) but still have it be your “website” your host can show you how to “point through” to that sub-directory.

    Now, when you get WordPress established, go get a theme that someone already made that has a format close to what you want. Be sure that they make it easy for you to use your own header image (most do). Then start modifying that to suit your needs. This is a lot easier than what you are doing.

    To see some themes, Go Here

    Good luck

    The index page is usually intended to show a list of recent posts – to get to the usual “comments” area you would click thru to a single post – if you look at your single.php (assuming your Theme has one) you’d see the line shown above:

    <?php comments_template(); ?>

    This inserts the comment area

    It isn’t generally advised to put a comments area on your home (index) page unless you intend to only show the single most recent post – otherwise your page would get very long if people comment on every post on your home page….

    I also agree with mechx1 – not sure why you’d use a table structure because it opens the door to messing things up if you want to add to it – you need to be very careful about opening rows (tr) and cells (td) without closing them properly, and making sure your rowspans and colspans stay correct…

    Also I just looked at the page you linked to above – no offense intended but your tutorial is way off……that is a very messy way to display blog posts on an html page and it’s completely unnecessary to include your database connection information…..

    All you need to do is make sure your .htaccess file allows you to use PHP from within an HTML file – you do that by adding this line to your .htaccess:

    AddType x-mapp-php4 .html

    You can change the “php4” to “php5” if that’s what is on your server.

    Then somewhere in your HTML page (I suggest just before your php function) you add a call to the wp_blog_header, like this:

    <?php require('./Blog/wp-blog-header.php'); ?>

    Then you can call the function to list the posts…….

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘wordpress comments’ is closed to new replies.