WordPress.org

Ready to get started?Download WordPress

Forums

Getting error in Theme-check plugin (1 post)

  1. shikhadas
    Member
    Posted 1 year ago #

    I am creating a new theme to be submitted to wordpress.org and getting below error while checking with Theme-check plugin. I have fixed many errors but not able to fix below. Please help.

    REQUIRED: The theme doesn't have comment pagination code in it. Use paginate_comments_links() or next_comments_link() and previous_comments_link() to add comment pagination.
    REQUIRED: Could not find the comment-reply script enqueued. See: Migrating Plugins and Themes to 2.7/Enhanced Comment Display
     <?php if ( is_singular() ) wp_enqueue_script( "comment-reply" ); ?>
    REQUIRED: Could not find wp_list_comments. See: wp_list_comments
     <?php wp_list_comments( $args ); ?>
    REQUIRED: Could not find comment_form. See: comment_form
     <?php comment_form(); ?>

    My comments.php file is as below

    <div id="comments">
    	<!-- Prevents loading the file directly -->
    	<?php if(!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) : ?>
    	    <?php die('Please do not load this page directly or we will hunt you down. Thanks and have a great day!'); ?>
    	<?php endif; ?>
    
    	<!-- Password Required -->
    	<?php if(!empty($post->post_password)) : ?>
    	    <?php if($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) : ?>
    	    <?php endif; ?>
    	<?php endif; ?>
    
    	<?php $i++; ?> <!-- variable for alternating comment styles -->
    	<?php if($comments) : ?>
    		<h3><?php comments_number('No comments', 'One comment', '% comments'); ?></h3>
    	    <ol>
    	    <?php foreach($comments as $comment) : ?>
    	    	<?php $comment_type = get_comment_type(); ?> <!-- checks for comment type -->
    	    	<?php if($comment_type == 'comment') { ?> <!-- outputs only comments -->
    		        <li id="comment-<?php comment_ID(); ?>" class="comment <?php if($i&1) { echo 'odd';} else {echo 'even';} ?> <?php $user_info = get_userdata(1); if ($user_info->ID == $comment->user_id) echo 'authorComment'; ?> <?php if ($comment->user_id > 0) echo 'user-comment'; ?>">
    		            <?php if ($comment->comment_approved == '0') : ?> <!-- if comment is awaiting approval -->
    		                <p class="waiting-for-approval">
    		                	<em><?php _e('Your comment is awaiting approval.'); ?></em>
    		                </p>
    		            <?php endif; ?>
    		            <div class="comment-text">
    			            <?php comment_text(); ?>
    		            </div><!--.commentText-->
    		            <div class="comment-meta">
    		            	<?php edit_comment_link('Edit Comment', '', ''); ?>
    		            	<?php comment_type(); ?> by <?php comment_author_link(); ?> on <?php comment_date(); ?> at <?php comment_time(); ?>
    		            	<p class="gravatar"><?php if(function_exists('get_avatar')) { echo get_avatar($comment, '36'); } ?></p>
    		            </div><!--.commentMeta-->
    		        </li>
    			<?php } else { $trackback = true; } ?>
    	    <?php endforeach; ?>
    	    </ol>
    	    <?php if ($trackback == true) { ?><!-- checks for comment type: trackback -->
    	    <h3>Trackbacks</h3>
    		    <ol>
    		    	<!-- outputs trackbacks -->
    			    <?php foreach ($comments as $comment) : ?>
    				    <?php $comment_type = get_comment_type(); ?>
    				    <?php if($comment_type != 'comment') { ?>
    					    <li><?php comment_author_link() ?></li>
    				    <?php } ?>
    			    <?php endforeach; ?>
    		    </ol>
    	    <?php } ?>
    	<?php else : ?>
    	    <p><?php _e('No comments yet. You should be kind and add one!'); ?></p>
    	<?php endif; ?>
    
    	<div id="comments-form">
    		<?php if(comments_open()) : ?>
    			<?php if(get_option('comment_registration') && !$user_ID) : ?>
    				<p><?php _e('Our apologies, you must be '); ?><a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>"><?php _e('logged in'); ?></a><?php _e(' to post a comment.'); ?></p><?php else : ?>
    				<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    					<?php if($user_ID) : ?>
    						<p><?php _e('Logged in as '); ?><a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account"><?php _e('Log out'); ?> &raquo;</a></p>
    						<?php else : ?>
    			            	<p><?php _e('Allowed HTML tags:'); ?> <?php echo allowed_tags(); /* outputs the html tags that are allowed in comments */ ?></p>
    			            	<p>
    								<label for="author"><small><?php _e('Name'); ?> <?php if($req) echo "(required)"; ?></small></label>
    								<input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
    							</p>
    							<p>
    								<label for="email"><small><?php _e('Mail (will not be shared)'); ?> <?php if($req) echo "(required)"; ?></small></label>
    								<input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
    							</p>
    							<p>
    								<label for="url"><small><?php _e('Website'); ?></small></label>
    								<input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
    							</p>
    						<?php endif; ?>
    							<p>
    								<label for="comment"><small><?php _e('Comment'); ?></small></label>
    								<textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea>
    							</p>
    							<p>
    								<input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
    								<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    							</p>
    				         <?php do_action('comment_form', $post->ID); ?>
    			     </form>
    				<p><small><?php _e('By submitting a comment you grant '); bloginfo('name'); _e(' a perpetual license to reproduce your words and name/web site in attribution. Inappropriate and irrelevant comments will be removed at an admin’s discretion. Your email is used for verification purposes only, it will never be shared.'); ?></small></p>
    			<?php endif; ?>
    		<?php else : ?>
    			<p><?php _e('The comments are closed.'); ?></p>
    		<?php endif; ?>
    	</div><!--#commentsForm-->
    </div><!--#comments-->

    and my functions.php

    <?php
    if ( ! isset( $content_width ) )
    	$content_width = 625;
    
    define( 'TEMPPATH', get_bloginfo('template_url'));
    define( 'IMAGES', TEMPPATH. "/images"); 
    
    $args = array(
    	'default-color'          => '',
    	'default-image'          => '',
    	'wp-head-callback'       => '_custom_background_cb',
    	'admin-head-callback'    => '',
    	'admin-preview-callback' => ''
    );
    
    add_theme_support( 'automatic-feed-links' );
    
    	// enables wigitized sidebars
    	if ( function_exists('register_sidebar') )
    
    	// Sidebar Widget
    	// Location: the sidebar
    	register_sidebar(array('name'=>'Sidebar',
    		'before_widget' => '<div class="widget-area widget-sidebar"><ul>',
    		'after_widget' => '</ul></div>',
    		'before_title' => '<h3>',
    		'after_title' => '</h3>',
    	));
    	// Header Widget
    	// Location: right after the navigation
    	register_sidebar(array('name'=>'Header',
    		'before_widget' => '<div class="widget-area widget-header"><ul>',
    		'after_widget' => '</ul></div>',
    		'before_title' => '<h4>',
    		'after_title' => '</h4>',
    	));
    	// Footer Widget
    	// Location: at the top of the footer, above the copyright
    	register_sidebar(array('name'=>'Footer',
    		'before_widget' => '<div class="widget-area widget-footer"><ul>',
    		'after_widget' => '</ul></div>',
    		'before_title' => '<h4>',
    		'after_title' => '</h4>',
    	));
    	// The Alert Widget
    	// Location: displayed on the top of the home page, right after the header, right before the loop, within the content area
    	register_sidebar(array('name'=>'Alert',
    		'before_widget' => '<div class="widget-area widget-alert"><ul>',
    		'after_widget' => '</ul></div>',
    		'before_title' => '<h4>',
    		'after_title' => '</h4>',
    	));
    
    	// post thumbnail support
    	add_theme_support( 'post-thumbnails' );
    	// adds the post thumbnail to the RSS feed
    	function cwc_rss_post_thumbnail($content) {
    	    global $post;
    	    if(has_post_thumbnail($post->ID)) {
    	        $content = '<p>' . get_the_post_thumbnail($post->ID) .
    	        '</p>' . get_the_content();
    	    }
    	    return $content;
    	}
    	add_filter('the_excerpt_rss', 'cwc_rss_post_thumbnail');
    	add_filter('the_content_feed', 'cwc_rss_post_thumbnail');
    
    	// custom menu support
    	add_theme_support( 'menus' );
    	if ( function_exists( 'register_nav_menus' ) ) {
    	  	register_nav_menus(
    	  		array(
    	  		  'header-menu' => 'Header Menu',
    	  		  'sidebar-menu' => 'Sidebar Menu',
    	  		  'footer-menu' => 'Footer Menu',
    	  		  'logged-in-menu' => 'Logged In Menu'
    	  		)
    	  	);
    	}
    
    	require_once('business-manager.php');
    	require_once('theme-options.php');
    	require_once('director-widgets.php');
    
    	add_action('init', 'director_rewrite');
        function director_rewrite() {
        global $wp_rewrite;
        $wp_rewrite->add_permastruct('typename', 'typename/%year%/%postname%/', true, 1);
        add_rewrite_rule('typename/([0-9]{4})/(.+)/?$', 'index.php?typename=$matches[2]', 'top');
        $wp_rewrite->flush_rules(); // !!!
        }
    
    	// custom background support
    	//add_custom_background();
    	add_theme_support( 'custom-background', $args );
    
    	// custom header image support
    	define('NO_HEADER_TEXT', true );
    	define('HEADER_IMAGE', '%s/images/default-header.png'); // %s is the template dir uri
    	define('HEADER_IMAGE_WIDTH', 1068); // use width and height appropriate for your theme
    	define('HEADER_IMAGE_HEIGHT', 300);
    	// gets included in the admin header
    	function admin_header_style() {
    	    ?><style type="text/css">
    	        #headimg {
    	            width: <?php echo HEADER_IMAGE_WIDTH; ?>px;
    	            height: <?php echo HEADER_IMAGE_HEIGHT; ?>px;
    	        }
    	    </style><?php
    	}
    	//add_custom_image_header( '', 'admin_header_style' );
    	add_theme_support( 'custom-header' );
    
    	// adds Post Format support
    	// learn more: http://codex.wordpress.org/Post_Formats
    	// add_theme_support( 'post-formats', array( 'aside', 'gallery','link','image','quote','status','video','audio','chat' ) );
    
    	// removes detailed login error information for security
    	add_filter('login_errors',create_function('$a', "return null;"));
    
    	// removes the WordPress version from your header for security
    	function wb_remove_version() {
    		return '<!--built on the Whiteboard Framework-->';
    	}
    	add_filter('the_generator', 'wb_remove_version');
    
    	// Removes Trackbacks from the comment cout
    	add_filter('get_comments_number', 'comment_count', 0);
    	function comment_count( $count ) {
    		if ( ! is_admin() ) {
    			global $id;
    			$comments_by_type = &separate_comments(get_comments('status=approve&post_id=' . $id));
    			return count($comments_by_type['comment']);
    		} else {
    			return $count;
    		}
    	}
    
    	// invite rss subscribers to comment
    	function rss_comment_footer($content) {
    		if (is_feed()) {
    			if (comments_open()) {
    				$content .= 'Comments are open! <a href="'.get_permalink().'">Add yours!</a>';
    			}
    		}
    		return $content;
    	}
    
    	// custom excerpt ellipses for 2.9+
    	// function custom_excerpt_more($more) {
    	// 	return 'Read More &raquo;';
    	// }
    	// add_filter('excerpt_more', 'custom_excerpt_more');
    
    	function director_excerpt_more($more) {
    		return ' <a href="'. get_permalink() .'">Continue...</a>';
       }
    
       add_filter('excerpt_more', 'director_excerpt_more', 999);
    	// no more jumping for read more link
    	function no_more_jumping($post) {
    		return '<a href="'.get_permalink($post->ID).'" class="read-more">'.'&nbsp; Continue Reading &raquo;'.'</a>';
    	}
    	add_filter('excerpt_more', 'no_more_jumping');
    
    	// category id in body and post class
    	function category_id_class($classes) {
    		global $post;
    		foreach((get_the_category($post->ID)) as $category)
    			$classes [] = 'cat-' . $category->cat_ID . '-id';
    			return $classes;
    	}
    	add_filter('post_class', 'category_id_class');
    	add_filter('body_class', 'category_id_class');
    
    	// adds a class to the post if there is a thumbnail
    	function has_thumb_class($classes) {
    		global $post;
    		if( has_post_thumbnail($post->ID) ) { $classes[] = 'has_thumb'; }
    			return $classes;
    	}
    	add_filter('post_class', 'has_thumb_class');
    
    	// add_action( 'admin_init', 'theme_options_init' );
    	// add_action( 'admin_menu', 'theme_options_add_page' );
    
    	// Init plugin options to white list our options
    	// function theme_options_init(){
    	// 	register_setting( 'tat_options', 'tat_theme_options', 'theme_options_validate' );
    	// }
    
    	// Load up the menu page
    	// function theme_options_add_page() {
    	// 	add_theme_page( __( 'Theme Options', 'tat_theme' ), __( 'Theme Options', 'tat_theme' ), 'edit_theme_options', 'theme_options', 'theme_options_do_page' );
    	// }
    
    	// begin LifeGuard Assistant
    	// learn more about the LifeGuard Assistant: http://wplifeguard.com/lifeguard-plugin/
    	// learn more about the affiliate program: http://wplifeguard.com/affiliates/
    	add_action('admin_menu', 'lgap_add_pages');
    	function lgap_add_pages() {
    		add_theme_page(__('Help','menu-test'), __('Help','menu-test'), 'read', 'lifeguard-assistant-plugin', 'lgap_main_page' );
    	}
    	function lgap_main_page() {
    		echo "<h2>" . __( 'Help', 'menu-test' ) . "</h2>";
    		// place your affiliate ID between the " on the following line
    		$lgap_aff = "";
    		// get your affiliate ID here: http://wplifeguard.com/wp-admin/profile.php?page=affiliateearnings
    		echo '
    		<style type="text/css">
    			#wplg { font-family: "Varela",Helvetica,Trebuchet MS,Verdana,"DejaVu Sans",sans-serif; }
    			#wplg a:link,#wplg a:visited { color: #21759b; text-decoration: none; }
    			#wplg a:hover { color: #d54e21; }
    			.wplg-video { background: #f6f6f6; border: 1px solid #dadada; padding: 12px; margin: 0 12px 12px 0; float: left; }
    			.wplg-clear { clear: both; }
    			.wplg-green-button { box-shadow:inset 0 0 3px rgba(0,0,0,.1); font-size: 20px; line-height: 32px; height: 32px; width: 434px; margin: 0 12px 12px 0; text-align: center; display: block; border: 2px solid #9abf89; background: #7da742; color: #f1ffeb !important; text-shadow: 0 0 3px rgba(125,167,66,.75); }
    			.wplg-green-button:hover { border: 2px solid #c0e1aa; background: #8ac636; }
    			.wplg-green-button:active { border: 2px solid #88a65e; background: #5d822a; }
    		</style>
    		<link href="http://fonts.googleapis.com/css?family=Varela" rel="stylesheet" type="text/css">
    		<div id="wplg">
    			<p>Need help with WordPress? Here is a collection of free WordPress video tutorials from <a href="http://wplifeguard.com/'.$lgap_aff.'">wpLifeGuard</a> to help you get going. <a href="http://wplifeguard.com/get-access/'.$lgap_aff.'">Get access to more videos.</a></p>
    			<div class="wplg-video"><iframe src="http://player.vimeo.com/video/32852753?title=0&byline=0&portrait=0&color=ffffff" width="412" height="309" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
    			<div class="wplg-video"><iframe src="http://player.vimeo.com/video/32856785?title=0&byline=0&portrait=0&color=ffffff" width="412" height="309" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
    			<div class="wplg-video"><iframe src="http://player.vimeo.com/video/32857648?title=0&byline=0&portrait=0&color=ffffff" width="412" height="309" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
    			<div class="wplg-video"><iframe src="http://player.vimeo.com/video/32860297?title=0&byline=0&portrait=0&color=ffffff" width="412" height="309" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
    			<div class="wplg-video"><iframe src="http://player.vimeo.com/video/32872861?title=0&byline=0&portrait=0&color=ffffff" width="412" height="309" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
    			<div class="wplg-video"><iframe src="http://player.vimeo.com/video/32878118?title=0&byline=0&portrait=0&color=ffffff" width="412" height="309" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
    			<div class="wplg-video"><iframe src="http://player.vimeo.com/video/32881530?title=0&byline=0&portrait=0&color=ffffff" width="412" height="309" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
    			<div class="wplg-video"><iframe src="http://player.vimeo.com/video/32864178?title=0&byline=0&portrait=0&color=ffffff" width="412" height="309" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
    			<div class="wplg-video"><iframe src="http://player.vimeo.com/video/32863614?title=0&byline=0&portrait=0&color=ffffff" width="412" height="309" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
    			<div class="wplg-video"><iframe src="http://player.vimeo.com/video/32862744?title=0&byline=0&portrait=0&color=ffffff" width="412" height="309" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
    			<div class="wplg-video"><iframe src="http://player.vimeo.com/video/32857481?title=0&byline=0&portrait=0&color=ffffff" width="412" height="309" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></div>
    			<div class="wplg-clear"></div>
    			<a class="wplg-green-button" href="http://wplifeguard.com/get-access/'.$lgap_aff.'">Get Full Access Now</a>
    		</div>
    		';
    	}
    	// end LifeGuard Assistant
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic