Modify php code to pass a page id as a parameter in order to create a breadcrumb

I simply had to remove ‘is_page() && ‘ in both the if and the elseif

function the_ajax_breadcrumb($post_id) {
    ob_start();
    $args = array('page_id' => $post_id);
    $the_query = new WP_Query($args);
    $currentBefore="<li><a>";
    $currentAfter="</a></li>";
    while ( $the_query->have_posts() ) {
        $the_query->the_post();
        if ( !is_home() && !is_front_page() || is_paged() ) {
            echo '<nav class="breadcrumb"><ul>';
            if ( !$the_query->post->post_parent ) {
                echo $currentBefore;
                the_title();
                echo $currentAfter;
            }
            elseif ( $the_query->post->post_parent ) {
                $parent_id  = $the_query->post->post_parent;
                $breadcrumbs = array();
                while ($parent_id) {
                    $page = get_page($parent_id);
                    $breadcrumbs[] = '<li><a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a></li>';
                    $parent_id  = $page->post_parent;
                }
                $breadcrumbs = array_reverse($breadcrumbs);
                foreach ($breadcrumbs as $crumb) echo $crumb;
                echo $currentBefore;
                the_title();
                echo $currentAfter;
            }
            else {
                echo '<li>nope</li>';
            }
            echo '</ul></nav>';
        }
    }
    $result = ob_get_clean();
    return $result;
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)