3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php // conta $videos = get_posts( array( 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array( 'post-format-video' ), 'operator' => 'IN' ) ) ) ); $conta = count($videos); //echo $conta; //verifica if($conta == 1) { //echo 'igual a 1'; wp_reset_query(); $post_format_video_args = array( 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => -1, //'offset' => 1, //'showposts' => 1, array( 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array( 'post-format-video' ), //'operator' => 'NOT IN', ), ), ), ); } elseif($conta > 1) { //echo 'maior que 1'; wp_reset_query(); $post_format_video_args = array( 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => 1, //'offset' => 1, //'showposts' => 1, array( 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array( 'post-format-video' ), //'operator' => 'NOT IN', ), ), ), ); } $query_post_format_video = new wp_query($post_format_video_args); //wp_reset_postdata(); //mostra while( $query_post_format_video->have_posts() ) : $query_post_format_video->the_post(); if( has_post_format( 'video' ) ){ the_content(); } endwhile; ?>
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Call to undefined function get_posts() in /in/uYm4g:4 Stack trace: #0 {main} thrown in /in/uYm4g on line 4
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Fatal error: Call to undefined function get_posts() in /in/uYm4g on line 13
Process exited with code 255.
Output for 5.0.0 - 5.6.28
Fatal error: Call to undefined function get_posts() in /in/uYm4g on line 4
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: get_posts() in /in/uYm4g on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: get_posts() in /in/uYm4g on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: get_posts() in /in/uYm4g on line 4