3v4l.org

run code in 300+ PHP versions simultaneously
<?php get_header(); ?> <?php $tag = get_queried_object(); ?> <?php if($tag) : ?> <!-- Page Title --> <section id="home" class="xl-py t-center white fullwidth"> <!-- Background image - you can choose parallax ratio and offset --> <div class="bg-parallax" data-stellar-ratio="0.76" data-stellar-vertical-offset="0" data-background="<?php echo get_theme_file_uri('/assets/images/backgrounds/background_1.jpg'); ?>"></div> <!-- Container --> <div class="container relative"> <div class="white skrollr" data-0="opacity:1; transform:translateY(0px);" data-700="opacity:0; transform:translateY(220px);"> <h5 class="gray4">Продукты по категорию</h5> <h1 class="firasans lh-sm"><?php echo mb_strtoupper($tag->name); ?></h1> </div> </div> <!-- End Container --> </section> <!-- End Page Title --> <?php endif; ?> <!-- BLOG --> <section id="blog" class="bb-blog post-radius gray6 post-shadow lh-lg py bg-gray2"> <!-- Container for top elements --> <div class="container blog-utilities sm-pb t-center"> <div class="row clearfix"> <!-- Search Form --> <div class="col-md-8 col-md-offset-1 col-sm-9 col-xs-12"> <div class="cbp-search fullwidth no-mb"> <input id="search-post" type="text" placeholder="Поиск по название" autocomplete="off" data-search="h4" class="cbp-search-input bg-gray3 classic_form big radius-lg slow dark"> <div class="cbp-search-nothing">Нет результатов для <i>{{query}}</i></div> </div> </div> <!-- End Search Form --> <!-- Utilities --> <div class="col-md-3 col-sm-3 col-xs-12 t-left t-center-xs xxs-pt-mobile"> <div class="row clearfix"> <?php $args = array( 'taxonomy' => 'product_category', 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => true, ); $the_query = new WP_Term_Query($args); ?> <!-- Filters Category --> <div id="tags" class="dropdown drop-effect drop-icon"> <button class="dropdown-toggle extrabold font-10 circle bg-gray3 uppercase gray8 border-gray3 bg-colored-hover border-colored-hover white-hover slow" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Фильтр </button> <ul class="dropdown-menu font-12 normal black" aria-labelledby="dropdownMenu2"> <li data-filter="*" class="cbp-filter-item-active cbp-filter-item" ><div class="link">Все</div></li> <?php foreach($the_query->get_terms() as $term) : ?> <li data-filter=".<?php echo mb_strtolower($term->name); ?>" class="cbp-filter-item" ><div class="link"><?php echo $term->name; ?></div></li> <?php endforeach; ?> </ul> </div> </div> </div> <!-- End Utilities --> </div> </div> <!-- End Container for top elements --> <?php $searchProductsByCategory = [ 'posts_per_page' => 1, 'post_type' => 'product', 'ignore_sticky_posts' => 1, 'orderby' => 'id', 'tax_query' => [ [ 'taxonomy' => 'product_category', 'terms' => get_queried_object_id() ] ] ]; $foundProducts = new WP_Query($searchProductsByCategory); ?> <?php if($foundProducts->have_posts()) : ?> <!-- Container for posts --> <div class="container"> <!-- Blog Posts --> <div id="babolo-posts" class="cbp"> <?php while($foundProducts->have_posts()) : $foundProducts->the_post(); ?> <?php $productCategories = wp_get_object_terms(get_the_ID(), 'product_category'); $categories = []; $implodedCategoriesArray = []; $implodedSearchCategoriesArray = []; if(!empty($productCategories)) { if(!is_wp_error($productCategories)) { foreach($productCategories as $category) { $categories[] = $category; $implodedCategoriesArray[] = mb_strtoupper($category->name); $implodedSearchCategoriesArray[] = mb_strtolower($category->name); } $implodedCategories = implode(", ", $implodedCategoriesArray); $implodeForSearch = implode(" ", $implodedSearchCategoriesArray); } } $image = get_field('image')['sizes']['product'] ?? "no-image"; ?> <!-- Post --> <a href="<?php the_permalink(); ?>" class="cbp-item <?php echo $implodeForSearch ?? null; ?> radius"> <div> <img src="<?php echo $image; ?>" alt=""> </div> <!-- Post Texts --> <div class="xs-px xs-py xs-px-mobile bg-white bs-sm"> <!-- Title --> <h4 class="bold-subtitle dark"><?php the_title(); ?></h4> <!-- Sender, Tag, comments --> <p class="font-11"> Автор: <span class="underline-hover"><?php the_author(); ?></span> | <?php echo $implodedCategories ?? null; ?> </p> <!-- Post Message --> <p class="xxs-mt"> <?php the_excerpt(); ?> </p> </div> </a> <!-- End Post --> <?php endwhile; ?> </div> <!-- End Blog Posts --> </div> <!-- End Container for posts --> <?php endif; ?> <div class="t-center pt"> <!-- Here Your pagination code --> <?php //babolo_full_pagination($foundProducts->max_num_pages); ?> <?php echo paginate_links(array( 'total' => $foundProducts->max_num_pages )); ?> </div> </section> <!-- END BLOG --> <?php // $posts_array = get_posts( // array( // 'posts_per_page' => 1, // 'post_type' => 'product', // 'tax_query' => array( // array( // 'taxonomy' => 'product_category', // 'field' => 'term_id', // 'terms' => get_queried_object_id(), // ) // ) // ) // ); ?> <?php // $paged = get_query_var('paged') ? get_query_var('paged') : 1; // $the_query = new WP_Query( array( // 'post_type' => 'product', // 'posts_per_page' => 1, // 'paged' => $paged, // 'tax_query' => array( // array ( // 'taxonomy' => 'product_category', // 'terms' => get_queried_object_id() // ) // ), // ) ); // while ( $the_query->have_posts() ) : // $the_query->the_post(); // echo "<p>".the_title()."</p>"; // endwhile; /* Restore original Post Data * NB: Because we are using new WP_Query we aren't stomping on the * original $wp_query and it does not need to be reset. */ // wp_reset_postdata(); // babolo_full_pagination($the_query->max_num_pages); ?> <?php get_footer(); ?>
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.4, 8.3.6 - 8.3.7
Fatal error: Uncaught Error: Call to undefined function get_header() in /in/vQ9f4:1 Stack trace: #0 {main} thrown in /in/vQ9f4 on line 1
Process exited with code 255.
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Fatal error: Uncaught Error: Call to undefined function get_header() in /in/vQ9f4:1 Stack trace: #0 {main} thrown in /in/vQ9f4 on line 1
Process exited with code 255.
Output for 5.6.38
Parse error: syntax error, unexpected '?' in /in/vQ9f4 on line 105
Process exited with code 255.

preferences:
129.9 ms | 401 KiB | 209 Q