• DesignGrande

    (@designgrande)


    Hi I was trying your theme and when I try to add your recent post widget anywhere else I get this error:

    Notice: Undefined index: widget_title in C:\xampp\htdocs\dev\wp-content\themes\lovecraft\widgets\recent-posts.php on line 21

    Notice: Undefined index: number_of_posts in C:\xampp\htdocs\dev\wp-content\themes\lovecraft\widgets\recent-posts.php on line 22

Viewing 1 replies (of 1 total)
  • Thread Starter DesignGrande

    (@designgrande)

    This issue can be fixed using the following codes:

    $title = ( ! empty( $instance[‘title’] ) ) ? $instance[‘title’] : __( ‘Recent Posts’ );

    $number_of_posts = esc_attr(empty( $instance[‘number_of_posts’] ) ? 5 : $instance[‘number_of_posts’] );

    $title = esc_attr( apply_filters( ‘widget_title’, $title, $instance, $this->id_base ) );

    if ( ! $number_of_posts ) {
    $number_of_posts = 5;
    }

Viewing 1 replies (of 1 total)
  • The topic ‘Error with recent post widget’ is closed to new replies.