My web site working with out error in PHP 7 after I change PHP 8 the web site is giving this warning.
Warning: Try to learn property “ID” on null in D:xampphtdocsybawp-contentthemesyoung-brand-childfunctions.php on line 162
<?php
//embody(STYLESHEETPATH . '/lib/theme-meta-box.php');
require_once('lib/theme-meta-box.php');
require_once('lib/theme-options.php');
require_once('lib/custom-post.php');
// Menu register
register_nav_menus( array(
'major' => __( 'Main Navigation', 'young-brand' ),
'mobile-nav' => __( 'Cellular Navigation', 'young-brand' ),
'footer' => __( 'Footer Navigation', 'young-brand' ),
) );
// Picture
add_theme_support('post-thumbnails');
add_image_size ('share-holder', 140, 140, true);
add_image_size ('photo-gallery', 320, 240, true);
add_image_size ('lightbox-gallery', 850, 480, true);
add_image_size ('product-gall', 400, 600, true);
add_image_size ('testimonials', 95, 95, true);
add_image_size ('news-detail', 270, 220, true);
add_image_size ('news-update', 210, 160, true);
//Excerpt
perform excerpt($restrict) {
$excerpt = explode(' ', get_the_excerpt(), $restrict);
if (depend($excerpt)>=$restrict) {
array_pop($excerpt);
$excerpt = implode(" ",$excerpt);
} else {
$excerpt = implode(" ",$excerpt);
}
$excerpt = preg_replace('`[[^]]*]`','',$excerpt);
return $excerpt;
}
/* Operate to alter sender identify */perform wpb_sender_name( $original_email_from ) { return 'Younger Model Attire';}add_filter( 'wp_mail_from_name', 'wpb_sender_name' );
/* Multi Featured Picture
-----------------------------*/
if (class_exists('MultiPostThumbnails')) {
new MultiPostThumbnails(array(
'label' => 'Banner Picture',
'id' => 'feature-image-2',
'post_type' => 'yb_products'
)
);
new MultiPostThumbnails(array(
'label' => 'Product Image1',
'id' => 'product-image-1',
'post_type' => 'yb_products'
)
);
new MultiPostThumbnails(array(
'label' => 'Product Hover Picture',
'id' => 'product-image-2',
'post_type' => 'yb_products'
)
);
new MultiPostThumbnails(array(
'label' => 'Second Picture',
'id' => 'second-image-2',
'post_type' => 'yb_testimonials'
)
);
}
// Load our primary stylesheet.
perform spero_scripts_child() {
// Jquery
//wp_enqueue_script('jquery');
wp_deregister_script( 'jquery' );
wp_enqueue_script( 'jquery-min', get_stylesheet_directory_uri() . '/js/jquery-1.7.2.min.js', true, '1.0', false );
wp_enqueue_script( 'easing-js', get_stylesheet_directory_uri() . '/js/jquery.easing.min.js', true, '1.0', false );
wp_enqueue_script( 'custom-js', get_stylesheet_directory_uri() . '/js/jquery-ui-1.8.18.{custom}.min.js', true, '1.0', false );
wp_enqueue_script( 'hashchange-js', get_stylesheet_directory_uri() . '/js/jquery.ba-hashchange.min.js', true, '1.0', false );
wp_enqueue_script( 'mousewheel-js', get_stylesheet_directory_uri() . '/js/jquery.mousewheel.js', true, '1.0', true );
wp_enqueue_script( 'Scrollbar', get_stylesheet_directory_uri() . '/js/jquery.mCustomScrollbar.js', true, '1.0', false );
wp_enqueue_script( 'cufon-js', get_stylesheet_directory_uri() . '/js/cufon-yui.js', true, '1.0', false );
wp_enqueue_script( 'Aller_400-js', get_stylesheet_directory_uri() . '/js/Aller_400-Aller_700.font.js', true, '1.0', false );
wp_enqueue_script( 'cufon-colors-js', get_stylesheet_directory_uri() . '/js/cufon-colors.js', true, '1.0', false );
wp_enqueue_script( 'image-loaded-js', get_stylesheet_directory_uri() . '/js/jquery.image-loaded.js', true, '1.0', false );
wp_enqueue_script( 'skitter-js', get_stylesheet_directory_uri() . '/js/jquery.skitter.js', true, '1.0', false );
wp_enqueue_script( 'smoothDiv-js', get_stylesheet_directory_uri() . '/js/jquery.smoothDivScroll-1.2.js', true, '1.0', false );
wp_enqueue_script( 'supersized-js', get_stylesheet_directory_uri() . '/js/supersized.3.2.7.js', true, '1.0', false );
wp_enqueue_script( 'load-content-js', get_stylesheet_directory_uri() . '/js/load-content.js', true, '1.0', false );
wp_enqueue_script( 'transform-js', get_stylesheet_directory_uri() . '/js/jquery.transform-0.9.3.min_.js', true, '1.0', true );
wp_enqueue_script( 'RotateImageMenu-js', get_stylesheet_directory_uri() . '/js/jquery.RotateImageMenu.js', true, '1.0', true );
wp_enqueue_script( 'easyzoom-js', get_stylesheet_directory_uri() . '/js/easyzoom.js', true, '1.0', false );
wp_enqueue_script( 'Selectric-js', get_stylesheet_directory_uri() . '/js/jquery.selectric.min.js', true, '1.0', false );
//if(is_page('dwelling')) {}
wp_enqueue_script( 'jquery-sldr-js', get_stylesheet_directory_uri() . '/js/jquery.sidr.min.js', true, '1.0', true );
wp_enqueue_script( 'fancybox-js', get_stylesheet_directory_uri() . '/js/jquery.fancybox.js', true, '1.0', true );
wp_enqueue_script( 'bxslider-js', get_stylesheet_directory_uri() . '/js/jquery.bxslider.min.js', true, '1.0', true );
wp_enqueue_script( 'main-js', get_stylesheet_directory_uri() . '/js/primary.js', true, '1.0', true );
wp_enqueue_script( 'script-js', get_stylesheet_directory_uri() . '/js/script.js', true, '1.0', false );
wp_enqueue_script( 'supersized-js', get_stylesheet_directory_uri() . '/js/supersized.3.2.7.js', true, '1.0', false );
//CSS information
wp_dequeue_style( 'original-enqueue-stylesheet-handle' );
wp_deregister_style( 'original-register-stylesheet-handle' );
wp_enqueue_style( 'Scrollbar-css', get_stylesheet_directory_uri() . '/css/jquery.mCustomScrollbar.css', array());
wp_enqueue_style( 'Sliders-css', get_stylesheet_directory_uri() . '/css/sliders.css', array());
wp_enqueue_style( 'Supersized-css', get_stylesheet_directory_uri() . '/css/supersized.css', array());
wp_enqueue_style( 'Skitter-css', get_stylesheet_directory_uri() . '/css/skitter.types.css', array());
wp_enqueue_style( 'bxslider-css', get_stylesheet_directory_uri() . '/css/jquery.bxslider.css', array());
wp_enqueue_style( 'fancybox-css', get_stylesheet_directory_uri() . '/css/jquery.fancybox.css', array());
wp_enqueue_style( 'smooth-css', get_stylesheet_directory_uri() . '/css/smoothDivScroll.css', array());
wp_enqueue_style( 'rotating-css', get_stylesheet_directory_uri() . '/css/rotating-style.css', array());
wp_enqueue_style( 'easyzoom-css', get_stylesheet_directory_uri() . '/css/easyzoom.css', array());
wp_enqueue_style( 'selectric-css', get_stylesheet_directory_uri() . '/css/selectric.css', array());
wp_enqueue_style( 'jquery.sidr-css', get_stylesheet_directory_uri() . '/css/jquery.sidr.darkish.css', array());
wp_enqueue_style( 'style-css', get_stylesheet_directory_uri() . '/model.css', array());
wp_enqueue_style( 'responsive-css', get_stylesheet_directory_uri() . '/css/responsive.css', array());
}
add_action( 'wp_enqueue_scripts', 'spero_scripts_child' );
//Walker finction
class description_walker extends Walker_Nav_Menu {
perform start_el( &$output, $merchandise, $depth = 0, $args = array(), $id = 0 ) {
$indent = ( $depth ) ? str_repeat( "t", $depth ) : '';
$class_names = $worth="";
$courses = empty( $item->courses ) ? array() : (array) $item->courses;
$courses[] = 'menu-item-' . $item->ID;
$class_names = be a part of( ' ', apply_filters( 'nav_menu_css_class', array_filter( $courses ), $merchandise, $args ) );
$class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : '';
$id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $merchandise, $args );
$id = $id ? ' id="' . esc_attr( $id ) . '"' : '';
$output .= $indent . '<li' . $id . $worth . $class_names .'>';
$atts = array();
$atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : '';
$atts['target'] = ! empty( $item->goal ) ? $item->goal : '';
$atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : '';
$atts['href'] = ! empty( $item->url ) ? $item->url : '';
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $merchandise, $args );
$attributes="";
foreach ( $atts as $attr => $worth ) {
if ( ! empty( $worth ) ) {
$worth = ('href' === $attr ) ? esc_url( $worth ) : esc_attr( $worth );
$attributes .= ' ' . $attr . '="' . $worth . '"';
//$attributes .= ' ' . $attr . '="javascript:void(0)"';
}
}
$item_output = $args->earlier than;
$pg_name = apply_filters( 'the_title', $item->title, $item->ID );
$page_id = get_page_by_title( $pg_name );
$item_output .= '<a'. $attributes .' id="'.$page_id->ID.'">';
/** This filter is documented in wp-includes/post-template.php */
$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
$item_output .= '</a>';
$item_output .= $args->after;
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $merchandise, $depth, $args );
}
}
//Contact From {custom} mail
// Mail---> [careers position]
wpcf7_add_shortcode('careers', 'place', true);
perform place(){
world $publish;
//$args = array( 'post_type' => 'contactus' );
$args = array('post_type' => 'yb_careers', 'posts_per_page'=>-1 );
$myposts = get_posts( $args );
$output .= "<choose identify="place">";
//<possibility worth="Choose">Choose</possibility>";
foreach ( $myposts as $publish ) : setup_postdata($publish);
$title = get_the_title();
$slug = $post->post_name;
$output .= "<possibility worth="$title"> $title </possibility>";
endforeach;
//$output .= "<possibility worth="Take a look at" choose="chosen">take a look at choose</possibility>";
$output .= "</choose>";
return $output;
}
?>