• Resolved Naomioneill

    (@naomioneill)


    Hi,

    I just stared getting a warning message like this on some pages of my blogs

    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/naomikathreen/eatlikeanactress.com/wp-content/themes/loook/lib/tiles.php on line 199

    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/naomikathreen/eatlikeanactress.com/wp-content/themes/loook/lib/tiles.php on line 205

    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/naomikathreen/eatlikeanactress.com/wp-content/themes/loook/lib/tiles.php on line 199

    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/naomikathreen/eatlikeanactress.com/wp-content/themes/loook/lib/tiles.php on line 205

    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/naomikathreen/eatlikeanactress.com/wp-content/themes/loook/lib/tiles.php on line 199

    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /home/naomikathreen/eatlikeanactress.com/wp-content/themes/loook/lib/tiles.php on line 205

    You can see here https://www.eatlikeanactress.com/category/recent

    Why is this happening and what can I do to fix it??

    All the best

    Naomi

Viewing 15 replies - 1 through 15 (of 15 total)
  • Moderator t-p

    (@t-p)

    -try switching to the unedited default theme (Twenty Eleven) for a moment using the WP dashboard. If you don’t have access to your admin area, you can switch to the default theme by renaming your current theme’s folder in wp-content/themes via FTP or SFTP or whatever file management application your host provides. The idea is to force WordPress to fall back to the default theme to rule out any theme-specific issue.

    Thread Starter Naomioneill

    (@naomioneill)

    Hi t-p ! Thanks for the advice but I just tried that and it didnt work.. the message is still there.. is there something else I should try??!

    Can you share your code here?

    Thread Starter Naomioneill

    (@naomioneill)

    Where would I find the code?

    try removing your old theme from the dashboard. I think it should be ‘loook’
    Else try deleting the folder ‘loook’ from and switch to default theme.

    1. Login to wordpress admin
    2. Go To Appearance > Editor > Index.php (listed in right sidebar)
    3. Then, Share the code here

    Thread Starter Naomioneill

    (@naomioneill)

    Okay.. this is the code

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. Or better still – use the pastebin ]

    <?php get_header(); 
    
    /* get currently displayed category object
    **************************************************************************
    */
    $obj = get_queried_object();
    
    /* get settings
    **************************************************************************
    */
    
    global $data;
    
    global $menupos;
    
    $postorder = $data['catp_order'];
    $topstyle = strtolower(str_replace(' ','',$data['catp_topstyle']));
    $topsidebar = preg_replace("/[^0-9]/",'', $data['catp_topsidebar']);
    $topnum = preg_replace("/[^0-9]/",'', $data['catp_topnum']);
    $carousel = $data['catp_carousel'];
    $carouseltag = $data['catp_carouseltag'];
    $carouselnum = $data['catp_carouselnum'];
    $stylerest = strtolower(str_replace(' ','',$data['catp_reststyle']));
    $restsidebar = preg_replace("/[^0-9]/", '', $data['catp_catsidebar']);
    $topsliderheight = preg_replace("/[^0-9]/", '', $data['catp_topsliderheight']);
    $restsliderheight = preg_replace("/[^0-9]/", '', $data['catp_restsliderheight']);
    $slideroverlap = $data['catp_slideroverlap'];
    
    $nopostsmessage = '';
    $postclass = '';
    
    /* modify query
    **************************************************************************
    */
    
    global $paged;
    global $query_string;
    global $wp_query;
    global $styleset;
    
    $qargs = array(
    	'paged' => $paged,
    	'post_type' => 'post'
    );
    
    if($postorder == 'by date'){
    	$qrgs['orderby'] = 'date';
    	$qrgs['order'] = 'DESC';
    }
    else {
    	$qrgs['orderby'] = 'menu_order';
    	$qrgs['order'] = 'ASC';
    }
    
    $nargs = array_merge( $wp_query->query, $qargs );
    query_posts($nargs);
    
    /* collect tops
    **************************************************************************
    */
    
    $tops = array();
    $car = array();
    $rest = array();
    
    $type = $styleset[$topstyle]['type'];
    
    $numtops = 4;
    
    if(in_array($type,array('slider','fullslider','carousel'))){
    	if($topnum >= 1){
    		$numtops = $topnum;
    	}
    } // slider
    else {
    	if($topsidebar !== ''){ $numtops = $numtops -1; }
    } // tilegroup
    
    if(have_posts()){
    	$i = 1;
    	while ( have_posts() ) : the_post();
    
    		if($i <= $numtops){
    			$tops[] = $post;
    		}
    		else {
    			$rest[] = $post;
    		}
    	$i ++;
    	endwhile;
    }// have posts
    else {
    	$nopostsmessage = '<div class="error"><p>'.__( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'loook' ).'</p>'.get_search_form(false).'</div>';
    }
    
    wp_reset_query(); 
    
    /* display top content
    **************************************************************************
    */
    ?>
    <!-- topcontent begin -->
    <div id="topcontent" class="loook_indextop clearfix post_<?php echo $postclass; ?>">
    <?php
    	$def = array(
    		'pageid' => 0,
    		'style' => $topstyle,
    		'sidebar' => $topsidebar,
    		'topsliderheight' => $topsliderheight,
    		'catsliderheight' => $restsliderheight,
    		'fwslideroverlap' => $slideroverlap,
    		'blocktype' => 'toptiles',
    		'appearence' => 'catpages'
    	);
    
    	if(is_category() && !empty($obj)){
    		$def['category'] = $obj;
    	}
    
    	echo loook_dotilegroup($tops,$def);
    
    ?>
    
    </div><!--topcontent end-->
    
    <?php
    
    /* display main navigation if menu-position is set to 'below the content'
    **************************************************************************
    */
    
    if($data['menu_position'] == 'Below the top content' && !$menupos){
    	?>
    	</div><!--end contentwrap started in header.php-->
    
    	<nav id="primary-nav" role="navigation" class="navbelow clearfix" data-title="<?php echo __('Navigate to ...','loook'); ?>">
    	<?php
    		wp_nav_menu( array( 'theme_location' => 'primary-menu', 'depth' => 0, 'fallback_cb' => '', 'container' => 'div', 'container_class' => 'nojs') );
    	?>
    	</nav>
    
    	<!-- start contentwrap again -->
    	<div class="contentwrap clearfix relative">
    	<?php
    }
    ?>
    
    <?php
    
    	if(is_category() && !empty($obj)){
    
    		/* carousel */
    
    		if($carousel && $carouseltag !== '' && $carouseltag !== 'Select a tag:'){
    
    			if($carouselnum <4){ $carouselnum = 8;}
    
    			$cargs = array(
    				'tag' => $carouseltag,
    				'posts_per_page' => $carouselnum,
    				'category_name' => $obj->slug
    			);
    
    			$carq = new WP_Query($cargs);
    			$carposts = $carq->posts;
    			wp_reset_postdata();
    
    			if(count($carposts) >= 4){
    
    				$cardef = array(
    					'pageid' => 0,
    					'style' => 'style22',
    					'category' => $obj,
    					'blocktype' => 'cattiles',
    					'appearence' => 'catpages',
    					'blockheadline' => '<a href="'.get_term_link($carouseltag,'post_tag').'">'.$carouseltag.'</a>',
    				);
    
    				echo loook_dotilegroup($carposts,$cardef);
    
    			} // has posts
    
    		} // carousel active
    
    	} // on category pages	
    
    	/* rest posts */
    
    	$cdef = array(
    		'pageid' => 0,
    		'style' => $stylerest,
    		'sidebar' => $restsidebar,
    		'topsliderheight' => $topsliderheight,
    		'catsliderheight' => $restsliderheight,
    		'fwslideroverlap' => $slideroverlap,
    		'blocktype' => 'cattiles',
    		'appearence' => 'nofront',
    	);
    
    	if(is_category() && !empty($obj)){
    		$cdef['category'] = $obj;
    	}
    
    	if(!is_category()){
    		$cdef['noheadline'] = true;
    		echo loook_breadcrumb(__($data['breadcrumb_prefix'],'loook'),__($data['breadcrumb_home'],'loook'));
    	}
    
    	echo $nopostsmessage;
    
    	echo loook_dotilegroup($rest,$cdef);
    
    loook_pager();
    
    get_footer(); 
    
    ?>

    I have made some changes on two arrays which are as follows:

    $cardef = array(
    'pageid' => 0,
    'style' => 'style22',
    'category' => $obj,
    'blocktype' => 'cattiles',
    'appearence' => 'catpages',
    'blockheadline' => $carouseltag,
    );
    
    $cdef = array(
    'pageid' => 0,
    'style' => $stylerest,
    'sidebar' => $restsidebar,
    'topsliderheight' => $topsliderheight,
    'catsliderheight' => $restsliderheight,
    'fwslideroverlap' => $slideroverlap,
    'blocktype' => 'cattiles',
    'appearence' => 'nofront'
    );

    So, just search these array in your code and replace it.

    Thread Starter Naomioneill

    (@naomioneill)

    I tried changing those codes an this is what I got

    Parse error: syntax error, unexpected ‘&’, expecting T_STRING or T_VARIABLE or ‘$’ in /home/naomikathreen/eatlikeanactress.com/wp-content/themes/loook/index.php on line 109

    Try removing the last comma on chandanonline4u’s first array, so

    $cardef = array(
    'pageid' => 0,
    'style' => 'style22',
    'category' => $obj,
    'blocktype' => 'cattiles',
    'appearence' => 'catpages',
    'blockheadline' => $carouseltag,
    );

    becomes

    $cardef = array(
    'pageid' => 0,
    'style' => 'style22',
    'category' => $obj,
    'blocktype' => 'cattiles',
    'appearence' => 'catpages',
    'blockheadline' => $carouseltag
    );
    Thread Starter Naomioneill

    (@naomioneill)

    This is how my code looks when i add in the changes you both said.. am I doing it wrong?

    [ Moderator Note: Please post code or markup snippets between backticks or use the code button. ]

    <?php get_header(); 
    
    /* get currently displayed category object
    **************************************************************************
    */
    $obj = get_queried_object();
    
    /* get settings
    **************************************************************************
    */
    
    global $data;
    
    global $menupos;
    
    $postorder = $data['catp_order'];
    $topstyle = strtolower(str_replace(' ','',$data['catp_topstyle']));
    $topsidebar = preg_replace("/[^0-9]/",'', $data['catp_topsidebar']);
    $topnum = preg_replace("/[^0-9]/",'', $data['catp_topnum']);
    $carousel = $data['catp_carousel'];
    $carouseltag = $data['catp_carouseltag'];
    $carouselnum = $data['catp_carouselnum'];
    $stylerest = strtolower(str_replace(' ','',$data['catp_reststyle']));
    $restsidebar = preg_replace("/[^0-9]/", '', $data['catp_catsidebar']);
    $topsliderheight = preg_replace("/[^0-9]/", '', $data['catp_topsliderheight']);
    $restsliderheight = preg_replace("/[^0-9]/", '', $data['catp_restsliderheight']);
    $slideroverlap = $data['catp_slideroverlap'];
    
    $nopostsmessage = '';
    $postclass = '';
    
    /* modify query
    **************************************************************************
    */
    
    global $paged;
    global $query_string;
    global $wp_query;
    global $styleset;
    
    $qargs = array(
    	'paged' => $paged,
    	'post_type' => 'post'
    );
    
    if($postorder == 'by date'){
    	$qrgs['orderby'] = 'date';
    	$qrgs['order'] = 'DESC';
    }
    else {
    	$qrgs['orderby'] = 'menu_order';
    	$qrgs['order'] = 'ASC';
    }
    
    $nargs = array_merge( $wp_query->query, $qargs );
    query_posts($nargs);
    
    /* collect tops
    **************************************************************************
    */
    
    $tops = array();
    $car = array();
    $rest = array();
    
    $type = $styleset[$topstyle]['type'];
    
    $numtops = 4;
    
    if(in_array($type,array('slider','fullslider','carousel'))){
    	if($topnum >= 1){
    		$numtops = $topnum;
    	}
    } // slider
    else {
    	if($topsidebar !== ''){ $numtops = $numtops -1; }
    } // tilegroup
    
    if(have_posts()){
    	$i = 1;
    	while ( have_posts() ) : the_post();
    
    		if($i <= $numtops){
    			$tops[] = $post;
    		}
    		else {
    			$rest[] = $post;
    		}
    	$i ++;
    	endwhile;
    }// have posts
    else {
    	$nopostsmessage = '<div class="error"><p>'.__( 'Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'loook' ).'</p>'.get_search_form(false).'</div>';
    }
    
    wp_reset_query(); 
    
    /* display top content
    **************************************************************************
    */
    ?>
    <!-- topcontent begin -->
    <div id="topcontent" class="loook_indextop clearfix post_<?php echo $postclass; ?>">
    <?php
    	$cardef = array(
    'pageid' => 0,
    'style' => 'style22',
    'category' => $obj,
    'blocktype' => 'cattiles',
    'appearence' => 'catpages',
    'blockheadline' => $carouseltag
    );
    
    	if(is_category() && !empty($obj)){
    		$def['category'] = $obj;
    	}
    
    	echo loook_dotilegroup($tops,$def);
    
    ?>
    
    </div><!--topcontent end-->
    
    <?php
    
    /* display main navigation if menu-position is set to 'below the content'
    **************************************************************************
    */
    
    if($data['menu_position'] == 'Below the top content' && !$menupos){
    	?>
    	</div><!--end contentwrap started in header.php-->
    
    	<nav id="primary-nav" role="navigation" class="navbelow clearfix" data-title="<?php echo __('Navigate to ...','loook'); ?>">
    	<?php
    		wp_nav_menu( array( 'theme_location' => 'primary-menu', 'depth' => 0, 'fallback_cb' => '', 'container' => 'div', 'container_class' => 'nojs') );
    	?>
    	</nav>
    
    	<!-- start contentwrap again -->
    	<div class="contentwrap clearfix relative">
    	<?php
    }
    ?>
    
    <?php
    
    	if(is_category() && !empty($obj)){
    
    		/* carousel */
    
    		if($carousel && $carouseltag !== '' && $carouseltag !== 'Select a tag:'){
    
    			if($carouselnum <4){ $carouselnum = 8;}
    
    			$cargs = array(
    				'tag' => $carouseltag,
    				'posts_per_page' => $carouselnum,
    				'category_name' => $obj->slug
    			);
    
    			$carq = new WP_Query($cargs);
    			$carposts = $carq->posts;
    			wp_reset_postdata();
    
    			if(count($carposts) >= 4){
    
    				$cardef = array(
    					'pageid' => 0,
    					'style' => 'style22',
    					'category' => $obj,
    					'blocktype' => 'cattiles',
    					'appearence' => 'catpages',
    					'blockheadline' => '<a href="'.get_term_link($carouseltag,'post_tag').'">'.$carouseltag.'</a>',
    				);
    
    				echo loook_dotilegroup($carposts,$cardef);
    
    			} // has posts
    
    		} // carousel active
    
    	} // on category pages	
    
    	/* rest posts */
    
    	$cdef = array(
    'pageid' => 0,
    'style' => $stylerest,
    'sidebar' => $restsidebar,
    'topsliderheight' => $topsliderheight,
    'catsliderheight' => $restsliderheight,
    'fwslideroverlap' => $slideroverlap,
    'blocktype' => 'cattiles',
    'appearence' => 'nofront'
    );
    
    	if(is_category() && !empty($obj)){
    		$cdef['category'] = $obj;
    	}
    
    	if(!is_category()){
    		$cdef['noheadline'] = true;
    		echo loook_breadcrumb(__($data['breadcrumb_prefix'],'loook'),__($data['breadcrumb_home'],'loook'));
    	}
    
    	echo $nopostsmessage;
    
    	echo loook_dotilegroup($rest,$cdef);
    
    loook_pager();
    
    get_footer(); 
    
    ?>

    Remove One more comma from array named as “$cardef” and check then:

    $cardef = array(
    'pageid' => 0,
    'style' => 'style22',
    'category' => $obj,
    'blocktype' => 'cattiles',
    'appearence' => 'catpages',
    'blockheadline' => '<a href="'.get_term_link($carouseltag,'post_tag').'">'.$carouseltag.'</a>'
    );
    Thread Starter Naomioneill

    (@naomioneill)

    It still didn’t work Chandanonline4u.

    Is there anything else I can try??

    Can you debug your above code by commenting some chunks of code or share your details if do not have any problem. Because I am not able debug your code here in this way.

    Thread Starter Naomioneill

    (@naomioneill)

    Fixed!! Thank You Chandan!!

Viewing 15 replies - 1 through 15 (of 15 total)
  • The topic ‘Warning message on some of my blog pages’ is closed to new replies.