nihir
Forum Replies Created
-
Forum: Themes and Templates
In reply to: Showing comments on indexMaybe I’m stupid, but a simple answer to have WordPress 1.5 Show Comments (and optionally) with no Comment Form on the Front Page (index.php) has been extremely difficult to find. I think a lot of the problems have stemmed from some solutions not specifying the versions of WordPress they were using.
My solution uses a very simple solution:
STEP ONE:
Download this file.
Upload it to your plugins directory (/wp-content/plugins/)
Log in to the admin section of WordPress and click on the Plugins section and “Activate” the Plugin.https://www.meyerweb.com/eric/tools/wordpress/mw_comments_trackbacks.html
**IF YOU WANT THE COMMENT FORM TO APPEAR DON’T DO STEP TWO**
STEP TWO:Save the following code as a new .php file called: “comments-no-form.php”
How do you do this?
1. Open up Notepad
2. Copy and Paste all the code into Notepad
3. Save As “comments-no-form.php”Upload this new file to your current theme’s directory
(/wp-content/YOURTHEME/)**START OF CODE BELOW THIS LINE**
<?php // Do not delete these lines
if ('comments-no-form.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
?><p class="nocomments">This post is password protected. Enter the password to view comments.
<?php
return;
}
}/* This variable is for alternating comment background */
$oddcomment = 'alt';
?><!-- You can start editing here. -->
<?php if ($comments) : ?>
<h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3><ol class="commentlist">
<?php foreach ($comments as $comment) : ?>
<li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
<cite><?php comment_author_link() ?></cite> Says:
<?php if ($comment->comment_approved == '0') : ?>
<em>Due to underwhelming spam, your comment is awaiting moderation.</em>
<?php endif; ?><small class="commentmetadata"><a>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a> <?php edit_comment_link('e','',''); ?></small>
<?php comment_text() ?>
<?php /* Changes every other comment to a different class */
if ('alt' == $oddcomment) $oddcomment = '';
else $oddcomment = 'alt';
?><?php endforeach; /* end for each comment */ ?>
<?php if(is_wpuser_comment() != 0) {echo "I'm a CTT Member. Are you one? Sign up on the right. ";} //official comments addition ?>
<?php else : // this is displayed if there are no comments so far ?>
<?php if ('open' == $post->comment_status) : ?>
<!-- If comments are open, but there are no comments. --><?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p class="nocomments">Sorry, you're too late. If you were here earlier, you could have posted a comment, but you weren't, so you can't.<?php endif; ?>
<?php endif; // if you delete this the sky will fall on your head ?>
**LAST LINE OF CODE IS ABOVE THIS LINE**STEP THREE:
This is the last step. Find this code or the closest thing to it, using Notepad, in your theme’s index.php file
(/wp-content/YOUR THEME/):**FIRST LINE OF CODE BELOW THIS LINE**
<p class="postmetadata">Posted in <?php the_category(', ') ?> <strong>|</strong> <?php edit_post_link('Edit','','<strong>|</strong>'); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
**LAST LINE OF CODE ABOVE THIS LINE**Underneath the above code and before the
</div>
enter the following code:**FIRST LINE OF CODE BELOW THIS LINE**
<?php $comments = mw_comments(); include(TEMPLATEPATH . '/comments-no-form.php'); // Display comments
?>
**LAST LINE OF CODE ABOVE THIS LINE****IF YOU WANT THE COMMENT FORM TO APPEAR CHANGE THE ABOVE FROM:
comments-no-form.php
TO
comments.phpSave this file and upload it back exactly where you found it.
I know that looks hard, but I promise you, it’s very, very, very simple. Because of the limited options on formatting this page, I tried to make this as easy to read as possible. I’m sorry if it’s difficult to understand. If you have any questions, feel free to email me – My email address is my username A T myrealbox D O T com (obviously replace at with the @ symbol and DOT with .)
Forum: Themes and Templates
In reply to: Show comments on front pageMaybe I’m stupid, but a simple answer to have WordPress 1.5 Show Comments (and optionally) with no Comment Form on the Front Page (index.php) has been extremely difficult to find. I think a lot of the problems have stemmed from some solutions not specifying the versions of WordPress they were using.
My solution uses a very simple solution:
STEP ONE:
Download this file.
Upload it to your plugins directory (/wp-content/plugins/)
Log in to the admin section of WordPress and click on the Plugins section and “Activate” the Plugin.https://www.meyerweb.com/eric/tools/wordpress/mw_comments_trackbacks.html
**IF YOU WANT THE COMMENT FORM TO APPEAR DON’T DO STEP TWO**
STEP TWO:Save the following code as a new .php file called: “comments-no-form.php”
How do you do this?
1. Open up Notepad
2. Copy and Paste all the code into Notepad
3. Save As “comments-no-form.php”Upload this new file to your current theme’s directory
(/wp-content/YOURTHEME/)**START OF CODE BELOW THIS LINE**
<?php // Do not delete these lines
if ('comments-no-form.php' == basename($_SERVER['SCRIPT_FILENAME']))
die ('Please do not load this page directly. Thanks!');if (!empty($post->post_password)) { // if there's a password
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
?><p class="nocomments">This post is password protected. Enter the password to view comments.
<?php
return;
}
}/* This variable is for alternating comment background */
$oddcomment = 'alt';
?><!-- You can start editing here. -->
<?php if ($comments) : ?>
<h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3><ol class="commentlist">
<?php foreach ($comments as $comment) : ?>
<li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
<cite><?php comment_author_link() ?></cite> Says:
<?php if ($comment->comment_approved == '0') : ?>
<em>Due to underwhelming spam, your comment is awaiting moderation.</em>
<?php endif; ?><small class="commentmetadata"><a>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?></a> <?php edit_comment_link('e','',''); ?></small>
<?php comment_text() ?>
<?php /* Changes every other comment to a different class */
if ('alt' == $oddcomment) $oddcomment = '';
else $oddcomment = 'alt';
?><?php endforeach; /* end for each comment */ ?>
<?php if(is_wpuser_comment() != 0) {echo "I'm a CTT Member. Are you one? Sign up on the right. ";} //official comments addition ?>
<?php else : // this is displayed if there are no comments so far ?>
<?php if ('open' == $post->comment_status) : ?>
<!-- If comments are open, but there are no comments. --><?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p class="nocomments">Sorry, you're too late. If you were here earlier, you could have posted a comment, but you weren't, so you can't.<?php endif; ?>
<?php endif; // if you delete this the sky will fall on your head ?>
**LAST LINE OF CODE IS ABOVE THIS LINE**STEP THREE:
This is the last step. Find this code or the closest thing to it, using Notepad, in your theme’s index.php file
(/wp-content/YOUR THEME/):**FIRST LINE OF CODE BELOW THIS LINE**
<p class="postmetadata">Posted in <?php the_category(', ') ?> <strong>|</strong> <?php edit_post_link('Edit','','<strong>|</strong>'); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?>
**LAST LINE OF CODE ABOVE THIS LINE**Underneath the above code and before the
</div>
enter the following code:**FIRST LINE OF CODE BELOW THIS LINE**
<?php $comments = mw_comments(); include(TEMPLATEPATH . '/comments-no-form.php'); // Display comments
?>
**LAST LINE OF CODE ABOVE THIS LINE****IF YOU WANT THE COMMENT FORM TO APPEAR CHANGE THE ABOVE FROM:
comments-no-form.php
TO
comments.phpSave this file and upload it back exactly where you found it.
I know that looks hard, but I promise you, it’s very, very, very simple. Because of the limited options on formatting this page, I tried to make this as easy to read as possible. I’m sorry if it’s difficult to understand. If you have any questions, feel free to email me – My email address is my username A T myrealbox D O T com (obviously replace at with the @ symbol and DOT with .)