• Resolved Thinking Elvish

    (@thinking-elvish)


    Hi, my website is http://www.thinkingelvish.com and I have this error message showing up on the front page in the container marketing box:

    “Notice: Undefined offset: 3 in /hermes/bosnaweb05a/b1560/ipg.thinkingelvishcom/wp-content/themes/customizr/parts/class-content-featured_pages.php on line 167”

    This is the code on that php line:

    //limit text to 200 car

    This is the code showing after around that – not sure if it matters…

    //set page excerpt as default text if no $featured_text
                $text                           = ( empty($featured_text) && !post_password_required($featured_page_id) ) ? strip_tags(apply_filters( 'the_content' , $page->post_excerpt )) : $featured_text ;
                $text                           = ( empty($text) && !post_password_required($featured_page_id) ) ? strip_tags(apply_filters( 'the_content' , $page->post_content )) : $text ;
    
                //limit text to 200 car
                $default_fp_text_length         = apply_filters( 'tc_fp_text_length', 200 );
                $text                           = ( strlen($text) > $default_fp_text_length ) ? substr( $text , 0 , strpos( $text, ' ' , $default_fp_text_length) ). ' ...' : $text;
    
                //set the image : uses thumbnail if any then >> the first attached image then >> a holder script
                $fp_img_size                    = apply_filters( 'tc_fp_img_size' , 'tc-thumb' );
                $fp_img_id                      = apply_filters( 'fp_img_id', false , $fp_single_id , $featured_page_id );

    I really appreciate any help or advice. I am self-taught and totally new to undefined offsets… and coding for that matter

Viewing 7 replies - 1 through 7 (of 7 total)
  • //limit text to 200 car is on line 154, not 167. What code did you add to that file (or what version are you on)?

    Thread Starter Thinking Elvish

    (@thinking-elvish)

    I may have made some adjustments on the child theme – and I’ve updated the theme since then, so would the code on this page keep any updates that I made? Like I said, I’m completely new to all of this – so forgive me if I’m confusing. Early on in my website building process I made adjustments to the php and I crashed my site. I “fixed” it by replacing the code with the original code – but I think that was on the functions page and had nothing to do with this. Since then I haven’t touched the php files – I’ve been too afraid to.

    Also, my husband checked the website this morning on safari and the error code wasn’t there – but when I checked from my location on safari and on chrome – the error was still showing.

    I don’t know how to tell what is on what line without actually counting them – since the line number doesn’t show up. I manually counted down through the page to find line 167. :-/ If there are other lines of code that would help, I can copy them in…

    The version I’m using – would that be the version of wordpress? It is the most recent one… 3.9.1.

    Thank you!!!

    OK. Gotcha.

    Lines 166-7 actually have this:

    $image       = wp_get_attachment_image_src( $fp_img_id , $fp_img_size );
    $fp_img_size = ( null == $image[3] ) ? 'medium' : $fp_img_size ;

    The code is trying to get the 4th entry in the $image array (the first would be $image[0]) and the error message is saying that the 4th entry doesn’t exist. Probably because wp_get_attachment_image_src has returned false (rather than an array), which it can when the image doesn’t exist.

    tl;dr: It’s a bug.

    Solution: nikeo needs to fix it, but I’m pretty sure that it will go away once you set up featured images for your “Ordering” and “Contact Us” pages. Try that and let us know.

    Nope, it’s not a bug. I’ve been reminded of this problem where it was found to be a conflict with Jetpack photon.

    Disable parts of Jetpack until you find the one that makes the problem should go away.

    Thread Starter Thinking Elvish

    (@thinking-elvish)

    It worked! I’m so thankful for your help!!! It was disabling the Photon feature in JetPack that the trick. Phew!! Our launch is tomorrow so I’m so glad we got that fixed before then.

    SOOO GRATEFUL!!! 🙂

    Theme Author presscustomizr

    (@nikeo)

    Excellent catch @electricfeet! what a memory!

    Hehe. Rocco’s memory, to be precise 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Undefined Offset Notice on Front Page’ is closed to new replies.