• Hi! I’ve developed a WordPress theme for my site instead of trying to get the blog embedded in the site itself. Things are mostly working but I’ve got a problem where the page doesn’t display correctly after posting a comment.

    Here is a screenshot of the blog page where one can post a comment:
    https://img4.imageshack.us/img4/1490/blogpage.jpg

    Here is what the page looks like after a comment is posted:
    https://img40.imageshack.us/img40/7919/blogpagepost.jpg

    I’m using a CSS “equal height columns” technique or trick I found at this site:

    https://www.ejeliot.com/blog/61

    So, what I’m thinking is the “equal height columns” work is interfering with the blog posting behavior. What I would like to do is have the page scroll to the top after a comment is posted but I’m having trouble finding what happens when a comment is posted (which PHP files get invoked, etc). Or maybe, I just don’t fully understand what goes on when a comment is posted to the blog.

    When I switch to the default theme, everything works just fine.

    Any suggestions on how to tackle this or where to look to find out what goes on when a comment is posted to the blog?

    Thanks in advance!

    Peace…

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter tomdkat

    (@tomdkat)

    Anyone have any ideas?

    Thanks!

    Peace…

    Thread Starter tomdkat

    (@tomdkat)

    Ok, I’ve found the code in question and I have an idea of how to deal with my problem.

    In wp-comments-post.php, these lines of code appear at the bottom of the file:

    $location = empty($_POST['redirect_to']) ? get_comment_link($comment_id) : $_POST['redirect_to'] . '#comment-' . $comment_id;
    $location = apply_filters('comment_post_redirect', $location, $comment);
    
    wp_redirect($location);

    Since I’m not using a “redirect_to” parameter, the “get_comment_link()” function is invoked. As a result, after posting a comment the browser gets redirected to a URL like:

    https://www.mysite.com/work/blog/?p=3&cpage=1#comment-42

    I would like the browser to get redirected to this URL instead:

    https://www.mysite.com/work/blog/?p=3&cpage=1#content

    So, would I implement a version of get_comment_link() to return the URL I want or would I change wp-comments-post.php?

    Thanks!

    Peace…

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Help needed with a theme and posting comments’ is closed to new replies.