Error
Call to a member function have_posts() on null Error thrown with message "Call to a member function have_posts() on null" Stacktrace: #3 Error in /var/www/maurisse/selfieproject.pl/public/wp-content/themes/selfieproject/single-produkt.php:306 #2 include in /var/www/maurisse/selfieproject.pl/public/wp-includes/template-loader.php:106 #1 require_once in /var/www/maurisse/selfieproject.pl/public/wp-blog-header.php:19 #0 require in /var/www/maurisse/selfieproject.pl/public/index.php:17
Stack frames (4)
3
Error
/
single-produkt.php
306
2
include
/
var
/
www
/
maurisse
/
selfieproject.pl
/
public
/
wp-includes
/
template-loader.php
106
1
require_once
/
var
/
www
/
maurisse
/
selfieproject.pl
/
public
/
wp-blog-header.php
19
0
require
/
var
/
www
/
maurisse
/
selfieproject.pl
/
public
/
index.php
17
/
var
/
www
/
maurisse
/
selfieproject.pl
/
public
/
wp-content
/
themes
/
selfieproject
/
single-produkt.php
                    $args = array(
                        'tax_query' => array(
                            array(
                                'taxonomy' => 'categoryproduct',
                                'field' => 'id',
                                'terms' => array($taxonomy_id)
                            ),
                        ),
                        'post_type' => 'produkt',
                        'post__not_in' => array(get_the_ID())
                    );
 
                    // lets rock!
                    $query = new WP_Query($args);
 
                endforeach;
            endif;
            ?>
 
            <?php if ($query->have_posts()): ?>
                <?php $inc = 0; ?>
                <?php while ($query->have_posts()) : $query->the_post(); ?>
 
                    <div class="medium-2<?php echo($inc % 5 == 0 ? " medium-offset-1" : ""); ?> cell product-block-other">
                        <a href="<?php echo get_permalink(); ?>">
                            <?php the_post_thumbnail('product-list-thumb'); ?>
                        </a>
                        <h2 class="product-other-title"><?php echo the_title();?></h2>
                    </div>
                    <?php $inc++; ?>
                <?php endwhile; ?>
            <?php endif; ?>
            <?php wp_reset_query();   // Restore global post data stomped by the_post(). ?>
 
        </div>
 
 
        <div class="grid-x grid-margin-x product-porady" data-equalizer data-equalize-on="medium">
            <div class="medium-12">
                <header class="title title-porady">
/
var
/
www
/
maurisse
/
selfieproject.pl
/
public
/
wp-includes
/
template-loader.php
            }
 
            break;
        }
    }
 
    if ( ! $template ) {
        $template = get_index_template();
    }
 
    /**
     * Filters the path of the current template before including it.
     *
     * @since 3.0.0
     *
     * @param string $template The path of the template to include.
     */
    $template = apply_filters( 'template_include', $template );
    if ( $template ) {
        include $template;
    } elseif ( current_user_can( 'switch_themes' ) ) {
        $theme = wp_get_theme();
        if ( $theme->errors() ) {
            wp_die( $theme->errors() );
        }
    }
    return;
}
 
/
var
/
www
/
maurisse
/
selfieproject.pl
/
public
/
wp-blog-header.php
<?php
/**
 * Loads the WordPress environment and template.
 *
 * @package WordPress
 */
 
if ( ! isset( $wp_did_header ) ) {
 
    $wp_did_header = true;
 
    // Load the WordPress library.
    require_once __DIR__ . '/wp-load.php';
 
    // Set up the WordPress query.
    wp();
 
    // Load the theme template.
    require_once ABSPATH . WPINC . '/template-loader.php';
 
}
 
/
var
/
www
/
maurisse
/
selfieproject.pl
/
public
/
index.php
<?php
/**
 * Front to the WordPress application. This file doesn't do anything, but loads
 * wp-blog-header.php which does and tells WordPress to load the theme.
 *
 * @package WordPress
 */
 
/**
 * Tells WordPress to load the WordPress theme and output it.
 *
 * @var bool
 */
define( 'WP_USE_THEMES', true );
 
/** Loads the WordPress Environment and Template */
require __DIR__ . '/wp-blog-header.php';
 

Environment & details:

empty
empty
empty
empty
empty
Key Value
SERVER_SOFTWARE nginx/1.10.3
REQUEST_URI /produkt/test/
USER www-data
HOME /var/www
HTTP_CONNECTION Keep-Alive
HTTP_HOST selfieproject.de
HTTP_ACCEPT_ENCODING br,gzip
HTTP_IF_MODIFIED_SINCE Thu, 01 Dec 2022 14:16:39 GMT
HTTP_ACCEPT_LANGUAGE en-US,en;q=0.5
HTTP_ACCEPT text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_USER_AGENT CCBot/2.0 (https://commoncrawl.org/faq/)
REDIRECT_STATUS 200
SERVER_NAME selfieproject.de
SERVER_PORT 443
SERVER_ADDR 51.255.37.252
REMOTE_PORT 44790
REMOTE_ADDR 34.232.62.64
GATEWAY_INTERFACE CGI/1.1
HTTPS on
REQUEST_SCHEME https
SERVER_PROTOCOL HTTP/1.1
DOCUMENT_ROOT /var/www/maurisse/selfieproject.de/public
DOCUMENT_URI /index.php
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING
SCRIPT_FILENAME /var/www/maurisse/selfieproject.de/public/index.php
PATH_INFO
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1680371040.9371
REQUEST_TIME 1680371040
empty
0. Whoops\Handler\PrettyPageHandler