Custom loop not working in singular.php, working in other pages

For posterity’s sake, it was enough to call the global $wp_query variable right at the top of the split_posts() function, like this:

function split_posts($Query, $infinite = false) {

    global $wp_query;
    $temp_query = $wp_query;
    $wp_query   = NULL;
    $wp_query   = $Query;

    ...

}

Cheers!

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