• I’m using an old wordpress theme developer now no longer exists m getting this error:
    Warning: Cannot use a scalar value as an array in single.php on line 36.Code of single.php is below

    <?php
    global $helper;
    $post_id = get_query_var('p');
    session_start();
    //session_destroy();
    //exit;
    get_header();
    ?>
    
        <!-- BODY -->
    
        <div id="container">
        	<div class="container_res">
            	<div class="container_main">
                	<div class="col_left">
    
                        <div class="col_boxgrey3">
                        	<?php
    	       				/**
    	       				 * SHOW THE POST
    	       				 */
    
    	       				if (have_posts()) {
    	       					while (have_posts()) {
    	       						the_post();
    	       						//increase the post view count
    	       						$view =  (int)post_custom('tgt_post_view');
    	       						$the_ID = get_the_ID();
    	       						if (!$view) {
                                                                $view = 0;
    	       						}
    	       						if (!isset($_SESSION['view'][$the_ID]))
    	       						{
                                                                $view++;
                                                                update_post_meta($the_ID, 'tgt_post_view', $view);
                                                                $_SESSION['view'][$the_ID] = $the_ID;
    	       						}
                                                            //echo $_SESSION['view'][$the_ID];
    	       						//get the category
    	       						$categories = get_the_category($the_ID);
    	       				?>
                            <div class="box" style="border-bottom:none;">
                            	<div class="tags_link">
                                	<h1 style="float:left;"> <?php the_title() ?> </h1>
    											<?php echo $helper->link($helper->image('warning-icon.png', __('Report this Article','ad'), array('style' => 'float: right;', 'title' => __('Report this Article','ad'))), '?action=report&p=' . $the_ID) ?> 
    
    							</div>
    									<div class="sub_icon" style="margin-top:0px;">
    
    <ul>
    <li>
                                    		<?php echo $helper->image('icon_category.gif', 'Category') ?>
    	                                	<strong> <?php _e('Category:','ad');?> </strong>
    	                                	<?php echo $helper->link($categories[0]->name, get_category_link($categories[0]->term_id)) ?>
    	                                </li>
    <li>
    	                                    <?php echo $helper->image('icon_comment.png', 'Comment') ?>
    	                                    <strong> <?php _e('Comments:','ad');?> </strong>
    	                                    <?php echo get_comments_number(get_the_ID()) ?>
    	                                </li>
    <li>
                                        	<?php echo $helper->image('icon_view.gif', 'View') ?>
                                        	<strong> <?php _e('View:','ad');?> </strong>
                                        	<?php echo post_custom('tgt_post_view') ? post_custom('tgt_post_view') : '0' ?>
                                        </li>
    </ul>
                                </div>
                            </div>
    
                            <!-- ADVERTISING -->
                             <!-- END ADVERTISING -->
    
                            <div class="box article-content">
                               <?php
    										if ( is_active_sidebar( 'top-article-detail-widget-area' ) ) {
    										dynamic_sidebar( 'top-article-detail-widget-area' );
    									} ?>
                                    <!-- the content -->
                                    <?php the_content() ?>
                                    <!-- end content -->
                                <div class="tags_link">
                                	<p class="tags_link_p"><strong><?php _e('Tags','ad')?></strong></p>
                                	<?php the_tags('<span>', ', ', '</span>') ?>
                                </div>
                            </div>
    
                            <div class="box" style="border-bottom:none; background-color:#EEF3F8;">
                            	<p>
                            	<?php
                            	echo $helper->image(tgt_get_avatar_link(), get_the_author_meta('display_name'),
                            		array('style' => 'float:left; display:inline; margin-right:10px; padding:1px; border:1px #b2b2b2 solid;width: 86px; height:86px'));
                            	?>
    							<?php
                            	// display article source
                            	echo '<strong>' . __('Article\'s Source: ','ad') . '</strong>';
                            	echo $helper->link(get_permalink(), get_permalink() );
                            	echo '';    
    
    							// display author name
                            	echo '<strong>' . __('Author: ','ad') . '</strong>';
    											the_author_posts_link();
                            	echo '';                        	                       	
    
                            	// bio profile
    							$bio = get_the_author_meta('tgt_bio_profile');
    							if (!empty($bio)) {
                            	echo '<strong>' . __('Bio: ','ad') . '</strong>';
                            	echo get_the_author_meta('tgt_bio_profile');
                            	echo '
    
    ';
    							}
                            	$user_url = get_the_author_meta('user_url');
                            	if (!empty($user_url)){
                            		echo $helper->link(get_the_author_meta('user_displayname'), $user_url);
                            	}
                            	?>
                            	</p>
    
                                <div class="sub_icon">
    
    <ul>
    <li> <?php echo $helper->image('icon_author.png', 'author') ?><strong><?php _e('By:','ad')?></strong>
                                    	<?php
    											the_author_posts_link();
    											?>
                                    	</li>
    <li> <?php echo $helper->image('icon_writte.gif', 'writer') ?><strong><?php _e('Posted On:','ad')?></strong> <?php the_time('F j, Y') ?> </li>
    <li> <?php echo $helper->image('icon_live.png', 'live') ?><strong><?php _e('Published articles:','ad')?></strong> <?php the_author_posts()?> </li>
    </ul>
                                </div>
                            </div>
                            <!-- COMMENTS -->
    		               	<?php comments_template('', true); ?>
    
    								<?php tgt_generate_pagination('cpage', 2); ?>
    					</div>
    
    						<?php
    								if ('open' == $post->comment_status) {
    									include(TEMPLATEPATH . '/comment-form.php');
    								}
    						?>
                        <?php
                        	/***
                        	 * retrieve the category
                        	 */
                        	$cats = get_the_category();
                        	$number = get_option('tgt_recent_articles') ? get_option('tgt_recent_articles') : 10;
                        	$recent_articles = get_posts('category=' . $cats[0]->term_id . '&numberposts=' . $number .'&orderby=date&order=DESC');
    
                        ?>
                        <!-- Recent Artcle -->
                        <div class="col_boxgrey4" style="border:1px #d0dbe4 solid;">
                        	<div class="title" style="width:690px; height:34px; border-left:none; border-right:none; border-top:none;">
                            	<h2 style="margin-top:8px;">
                            	<?php
                            	_e('Most Recent Articles from ','ad');
                            	echo '<span>' . $cats[0]->name . '</span>';
                            	_e(' Category:','ad')
                            	?></h2>
                            </div>
    
                            <div class="box" style="border-bottom:none;">
                            	<div class="col_boxgrey5">
    
    <ul>
                                    	<?php
                                    		global $helper;
                                    		foreach ($recent_articles as $article )
                                    		{
                                    			echo '
    <li>' . $helper->link($article->post_title, get_permalink($article->ID)) .'</li>
    ';
                                    		}
                                    	?>
                                    </ul>
                                </div>
                                <!-- ADVERTISING -->
                               <?php
    						if ( is_active_sidebar( 'bottom-article-detail-widget-area' ) ) {
    						dynamic_sidebar( 'bottom-article-detail-widget-area' );
    						} ?>
                             <!-- END ADVERTISING -->
    
                            </div>
                        </div>
                        <?php
    	       					}
    	       				}
    
    	       			?>
    
                    </div>
    
                    <!-- END BODY -->
                    <?php get_sidebar() ?>
        <?php get_footer(); ?>
    
    <script type="text/javascript">
    jQuery(document).ready(function(){
    	jQuery('.comment-box-message').hide();
    	jQuery('#commentform').submit(function(){
    		<?php if (get_option('require_name_email') && !$user_ID) { ?>
    			if (jQuery.trim(jQuery('#comment-name').val()) == ''){
    				jQuery('.comment-box-message div').html("<?php _e("Name can't be empty",'ad')?>");
    				jQuery('.comment-box-message').show();
    				return false;
    			}
    			if (jQuery.trim(jQuery('#comment-email').val()) == ''){
    				jQuery('.comment-box-message div').html("<?php _e("Email can't be empty",'ad')?>");
    				jQuery('.comment-box-message').show();
    				return false;
    			}
    		<?php } ?>
    		<?php if (!$user_ID)  { ?>
    			if (!validateEmail(jQuery('#comment-email').val())){
    				jQuery('.comment-box-message div').html("<?php _e("Email is invalid",'ad')?>");
    				jQuery('.comment-box-message').show();
    				return false;
    			}
    			<?php } ?>
    			if (jQuery.trim(jQuery('#comment-content').val()) == ''){
    				jQuery('.comment-box-message div').html("<?php _e("Comment content can't be empty",'ad')?>");
    				jQuery('.comment-box-message').show();
    				return false;
    			}
    			jQuery('.comment-box-message').hide();
    	});
    });
    </script>

The topic ‘Warning: Cannot use a scalar value as an array’ is closed to new replies.