WordPress.org

Ready to get started?Download WordPress

Forums

PHP Code Checker (1 post)

  1. nhoernig
    Member
    Posted 4 years ago #

    I'll start off being straight-forward about it...

    I'm new to this.

    Now that that's out of the way, I'm following some php tutorials on how to create wordpress themes. Every step has caught me running back through my code character by character to try to find the mistake I made. As you probably know, it takes forever. Is there a website or Mac software that'll allow me to just toos my code in and it'll highlight the areas that are bad?

    Much appreciation in advance.

    Further, here's the code I can't seem to locate my mistake in. Commented like crazy since I'm just learning...

    There's no need to check it if you don't want to but my main thing is finding this website.

    <!--Start Security measures-->
    <!--Disallow page loading without linking into it & require a password to view post-->
    <?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; } ?>
    <!--End Security measures-->

    <!--Begin Comments loop-->
    <?php if(have_posts()) : ?>
    <h2><?php comments_number('Be the first to comment!', 'One Comment', '% Comments'); ?></h2>

    <!--Avatar display & Threading comments-->
    <ol id="comments_section">
    <?php wp_lists_comments(array['avatar_size'->80, 'reply_text'->'Reply to this comment!']); ?>

    <!--End Comments loop-->

    <!--Paginating comments-->
    <div><?php paginate_comments_links();?></div>

    <!--Invitation for the first comment-->
    <?php else: ?>
    <?php if('open' == $post->comment_status) : ?>
    <p>Have your say!</p>

    <!--If comments have been set to closed-->
    <?php else: ?>
    <p>Comments currently closed</p>

    <?php endif; ?>
    <?php endif; ?>

    <!--Displaying the comments form-->
    <?php if('open' == $post->comment_status) : ?>
    <div id='respond'>
    <!--Displays the title for creating a comment-->
    <h2><?php comment_form_title(); ?></h2>

    <!--Cancelling a reply after entering it-->
    <div id="cancel-comment-reply">
    <small><?php cancel_comment_reply_link(); ?></small>
    </div>

    <!--In case someone tries to comment without being logged in-->
    <?php if(get_option('comment_registration') && !$user_ID) : ?>
    <p>You must be logged in to comment</p>

    <!--If the above is NOT an issue, the form will display-->
    <?php else : ?>
    <form action="<?php echo get_option('site_url');?>/wp-comments-post.php" method="post" id="commentform">

    <!--Display a message stating that the user is logged in-->
    <?php if($user_ID) :?>
    <p>Logged in as /wp-admin/profile.php"><?php echo $user_identity; ?></p>

    <!--If NOT logged in, form field displays-->
    <?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">Email<?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>
    <!--Necessary for threading comments-->
    <?php comment_id_fields(); ?>
    <input type="hidden" name="redirect_to" value="<?php echo htmlspecialchars($_SERVER['REQUEST_URI'])?>" />
    </div>

    <!--text area displayed in form field-->
    <p><textarea id='comment' name='comment' cols='50' rows='10'></textarea></p>

    <!--Displays that comment is under moderation after posting-->
    <?php if(get_option('comment_moderation') == '1'){ ?>
    <p>Comment is under moderation, don't resubmit or any of that hubjub. It'll be up soon!</p>
    <?php } ?>

    <!--Submit button-->
    <p><input type="text" name="submit" id="submit" value="Submit" /></p>

    <!--Send off the comment-->
    <?php do_action('comment_form', $post->ID); ?>
    </form>
    <?php endif; ?>

    </div>
    <?php endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.