Click here to Skip to main content
15,306,017 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am learning making website for first time.
I installed XAMPP and installed WP.
I installed a theme I purchased several years ago.

I am unable to view the theme properly in my local host. The error I get is

Warning: Trying to access array offset on value of type null in Line...
Following are the lines of code with error: -

File name : Top bar
Line 4 with error

<?php global $adforest_theme; ?>
$msg_count = 0;
////LINE 4 with error ////  if (!$adforest_theme['sb_top_bar']) {

File name : sitelogo
Line 6 with error

<?php global $adforest_theme; ?>
<a href="<?php echo home_url('/'); ?>">
    $transparent_flag = false;
///Line 6 //// if ($adforest_theme['sb_header'] == 'transparent-2' || $adforest_theme['sb_header'] == 'transparent-3' || $adforest_theme['sb_header'] == 'modern' || $adforest_theme['sb_header'] == 'transparent') {
     $transparent_flag = true;  

File name : mainnav.php
Line 6 with error


global $adforest_theme;

$menu_ul_flag = true;
////line 6 //// if ($adforest_theme['sb_header'] == 'modern2' || $adforest_theme['sb_header'] == 'modern3') {
    $menu_ul_flag = false;

File name : blogloop.php
Line 23 with error

                        $no_img  =	'no-img';
                        $response	=	adforest_get_feature_image( get_the_ID(), 'adforest-category' );
  ////line 23///       if( $response[0] != "" )
                            $no_img  =	'';

What I have tried:

i dont know PHP programming therefore I did not try to alter the code. I have some experience with OOP which I learnt in class 12 in 2006. I think technology must have changed greatlys ince then.
Updated 7-May-21 22:13pm

1 solution

You are declaring a number of variables but you never initialise them to contain any data. So trying to reference something by using an offset will always fail. And unless you actually go and learn PHP properly you are really just wasting your time. See PHP Tutorial[^].

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900