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:74 #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
74
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
    elseif ( is_single()         && $template = get_single_template()         ) :
    elseif ( is_page()           && $template = get_page_template()           ) :
    elseif ( is_singular()       && $template = get_singular_template()       ) :
    elseif ( is_category()       && $template = get_category_template()       ) :
    elseif ( is_tag()            && $template = get_tag_template()            ) :
    elseif ( is_author()         && $template = get_author_template()         ) :
    elseif ( is_date()           && $template = get_date_template()           ) :
    elseif ( is_archive()        && $template = get_archive_template()        ) :
    else :
        $template = get_index_template();
    endif;
    /**
     * Filters the path of the current template before including it.
     *
     * @since 3.0.0
     *
     * @param string $template The path of the template to include.
     */
    if ( $template = apply_filters( 'template_include', $template ) ) {
        include( $template );
    } elseif ( current_user_can( 'switch_themes' ) ) {
        $theme = wp_get_theme();
        if ( $theme->errors() ) {
            wp_die( $theme->errors() );
        }
    }
    return;
endif;
 
/
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( dirname(__FILE__) . '/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( dirname( __FILE__ ) . '/wp-blog-header.php' );
 

Environment & details:

empty
empty
empty
empty
empty
Key Value
SERVER_SOFTWARE nginx/1.10.3
REQUEST_URI /produkt/cleansing-peel-mask-shine-like-a-dancing-queen/
USER www-data
HOME /var/www
HTTP_CONNECTION Keep-Alive
HTTP_HOST selfieproject.pl
HTTP_ACCEPT_ENCODING br,gzip
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.pl
SERVER_PORT 443
SERVER_ADDR 51.255.37.252
REMOTE_PORT 54904
REMOTE_ADDR 3.227.235.216
GATEWAY_INTERFACE CGI/1.1
HTTPS on
REQUEST_SCHEME https
SERVER_PROTOCOL HTTP/1.1
DOCUMENT_ROOT /var/www/maurisse/selfieproject.pl/public
DOCUMENT_URI /index.php
SCRIPT_NAME /index.php
CONTENT_LENGTH
CONTENT_TYPE
REQUEST_METHOD GET
QUERY_STRING
SCRIPT_FILENAME /var/www/maurisse/selfieproject.pl/public/index.php
PATH_INFO
FCGI_ROLE RESPONDER
PHP_SELF /index.php
REQUEST_TIME_FLOAT 1632770400.0889
REQUEST_TIME 1632770400
empty
0. Whoops\Handler\PrettyPageHandler