fork download
  1. <?php
  2.  
  3. $category_detail=get_the_category($post->ID);
  4. $post_id = $post->ID;
  5. $cat_id = -1;
  6. $cat_name = '';
  7. foreach($category_detail as $cd){
  8. if(substr( $cd->cat_name, 0, 3 ) === "TUT") {
  9. $cat_id = $cd->cat_ID;
  10. $cat_name = $cd->cat_name;
  11. break;
  12. }
  13. }
  14. if($cat_id > 0) { ?>
  15. <div id="sidebar">
  16. <h3 class="widgettitle"> <?php echo $cat_name; ?> </h3>
  17. <ul>
  18. <?php
  19. $catPost = get_posts('cat='.$cat_id.'&posts_per_page=-1&order=ASC&orderby=menu_order');
  20. $text = "class='tut-current-post'";
  21. foreach ($catPost as $post) : setup_postdata($post); ?>
  22.  
  23. <li><a href="<?php the_permalink(); ?> "
  24. <?php if($post_id == $post->ID) echo ' ' . $text; ?>
  25. >
  26. <?php the_title(); ?>
  27.  
  28. </a></li>
  29.  
  30. <?php endforeach;?>
  31. </ul>
  32. </div>
  33.  
  34. <?php }
  35. ?>
Runtime error #stdin #stdout #stderr 0.01s 82880KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
PHP Fatal error:  Uncaught Error: Call to undefined function get_the_category() in /home/SJRHEl/prog.php:3
Stack trace:
#0 {main}
  thrown in /home/SJRHEl/prog.php on line 3