3v4l.org

run code in 300+ PHP versions simultaneously
<div id="right2"> <?php if($post->ID==13) { $galleries = $wpdb->get_results('SELECT * FROM wp_ngg_gallery WHERE gid > 1 ORDER BY name;', OBJECT); echo "<a href=/?page_id=13>Gallery</a><br />"; echo "<ul>"; foreach ($galleries as $row) { echo "<li><a href=/?page_id=13&amp;album=1&amp;gallery=".$row->gid.">".$row->title."</a></li>"; } echo "</ul>"; } else { if($post->post_parent) $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0"); else $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0"); if ($children) { $galleries = $wpdb->get_results('SELECT p1.post_title, p1.post_parent, p2.post_title as parent_title FROM wp_posts as p1 LEFT OUTER JOIN wp_posts as p2 ON (p1.post_parent=p2.id) WHERE p1.id = '.$post->ID.';', OBJECT); foreach ($galleries as $row) { if ($row->post_parent > 0) echo "<a href=/?page_id=".$row->post_parent.">".$row->parent_title."</a>"; else echo "<a href=/?page_id=".$post->ID.">".$row->post_title."</a>"; } echo "<ul>"; echo $children; echo "</ul>"; } } ?> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(3) ) : ?> <?php endif; ?> </div> <!-- end right 2 -->

preferences:
43.24 ms | 402 KiB | 5 Q