• Resolved gfxbucket

    (@gfxbucket)


    I was watching an old tut where I learned how to make a comment.php file. They provided source code file. When I pasted it to my comments.php file, comment page is taking huge time to be loaded. I, then, copied and pasted default twenty fourteen’s comment.php file and it worked like charm. Here’s the source file I got from the tutorial. Please let me know why its not working properly. Can anyone use comments.php file from twenty fourteen to make commercial wordpress theme for themeforest or templatemonster? Thanks.

    <?php
    if(!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])){
    die('Please do not load this page directly!');
    }
    if(post_password_required()){
    ?>
    <p>This post is password protected.</p>
    <?php return; } ?>
    
    <?php
    //Display the comment loop
    if(have_comments()) :
    ?>
    <h2><?php comments_number('Be the first to comment!', 'One Comment', '% Comments'); ?></h2>
    <ol id='comments_section'>
    <?php wp_list_comments(array('avatar_size'=>80, 'reply_text'=>'Reply to this comment.')); ?>
    
    <div><?php paginate_comments_links(); ?></div>
    <?php
    else ://If no comments so far
    ?>
    
    <?php if('open' == $post->comment_status) : ?>
    <p>Have your say!</p>
    <?php else :?>
    <p>Comments currently closed!</p>
    <?php endif;?>
    <?php endif; ?>
    <?php if('open' == $post->comment_status) : ?>
    
    <div id='respond'>
    <h2><?php comment_form_title(); ?></h2>
    
    <div id='cancel-comment-reply'>
    <small><?php cancel_comment_reply_link(); ?></small>
    </div>
    
    <?php if(get_option('comment_registration') && !$user_ID): ?>
    <p>You must be logged in to comment</p>
    <?php else : ?>
    <form action="<?php echo get_option('site_url'); ?>/wordpress/wp-comments-post.php" method="post" id="commentform">
    
    <?php if($user_ID) :?>
    <p>Logged in as <a>/wp-admin/profile.php"><?php echo $user_identity; ?></a></p>
    
    <?php else : ?>
    <p><input type='text' name='author' id='author' value="<?php echo $comment_author;?>" />
    <label for='author'>Name</label></p>
    <p><input type='text' name='email' id='email' value="<?php echo $comment_author_email;?>" />
    <label for='email'>Mail <?php if($req) echo '(Required field)';?></label>
    </p>
    <p>
    <input type='text' name='url' id='url' value="<?php echo $comment_author_url; ?>" />
    <label for='url'>Website</label>
    </p>
    <?php endif; ?>
    <div><?php comment_id_fields(); ?>
    <input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($_SERVER['REQUEST_URI'])?>" />
    </div>
    
    <p><textarea id='comment' name='comment' cols='50' rows='10'></textarea></p>
    
    <?php if(get_option('comment_moderation') == '1'){ ?>
    <p>Comment moderation is enabled, no need to resubmit any comments posted.</p>
    <?php } ?> 
    
    <p><input type='submit' name='submit' id='submit' value='Submit' /></p>
    <?php do_action('comment_form', $post->ID); ?>
    </form>
    <?php endif; ?>
    </div>
    <?php endif; ?>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

Viewing 1 replies (of 1 total)
  • This is an interesting question. I too would be interested to know if this is possible to use in TF. Am thinking of using the complete 2014 theme and rejigging it for TF.

Viewing 1 replies (of 1 total)
  • The topic ‘Twenty Fourteen : Can I use Comments.php for a commercial project?’ is closed to new replies.