spider_random_post_fornt_end

The Business Responsive spider random post fornt end function.

Description

spider_random_post_fornt_end(); 

Usage

  1. if ( !function_exists( 'spider_random_post_fornt_end' ) ) { 
  2. require_once '/admin/widgets/Spider_Random_Post.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = spider_random_post_fornt_end(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/admin/widgets/Spider_Random_Post.php  
  1. function spider_random_post_fornt_end() { 
  2. if(isset($_GET['count_pages'])) { 
  3. if($_GET['count_pages']>0) { 
  4. $numberposts=$_GET['count_pages']; 
  5. else{ 
  6. $numberposts=1; 
  7. else{ 
  8. $numberposts=1; 
  9.  
  10. if(isset($_GET['categori_id'])) { 
  11. if($_GET['categori_id']>0) { 
  12. $cat_id=$_GET['categori_id']; 
  13. else{ 
  14. $cat_id=""; 
  15. else{ 
  16. $cat_id=""; 
  17.  
  18. $args = array( 
  19. 'numberposts' => $numberposts,  
  20. 'offset' => 0,  
  21. 'category' => $cat_id,  
  22. 'orderby' => 'rand',  
  23. 'order' => 'ASC',  
  24. 'post_type' => 'post',  
  25. 'post_status' => 'publish' ); 
  26. $lastposts = get_posts($args); 
  27.  
  28. foreach($lastposts as $post) { 
  29.  
  30. $content = $post->post_content; 
  31. $content = apply_filters('the_content', $content); 
  32. $content = str_replace(']]>', ']]>', $content); 
  33. ?> 
  34. <h2><a href="<?php echo get_permalink($post->ID); ?>"><?php echo get_the_title($post->ID); ?></a></h2>  
  35. <?php 
  36. echo $content; 
  37. }; 
  38. die(); 
  39.