Advertisement
BakerMan

Themes Kingdom: "Query" header code

Mar 26th, 2013
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 KB | None | 0 0
  1. <?php
  2.     $cat = get_option('query_slider_category');
  3.    
  4.     $catslug = get_cat_name( $cat );
  5.  
  6.     $args=array('category_name'=>$catslug, 'post_status' => 'publish','posts_per_page' => 5);
  7.                    
  8.     query_posts($args);
  9.     while (have_posts()) : the_post();
  10.     $img = "";
  11.     if (has_post_thumbnail()) {
  12.         $imagedata = simplexml_load_string(get_the_post_thumbnail());
  13.         $img = $imagedata->attributes()->src;
  14.     }
  15.    
  16.     if ($post->post_content<>substr($post->post_content,0,70)){ $dots2 = "...";}else{$dots2 = "";}
  17.     $cont = substr($post->post_content,0,70);
  18.  
  19.     if ($post->post_title<>substr($post->post_title,0,26)){ $dots3 = "...";}else{$dots3 = "";}
  20.     $title1 = substr($post->post_title,0,26);
  21.    
  22.      $pageURL = 'http';
  23.      if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
  24.      $pageURL .= "://";
  25.      if ($_SERVER["SERVER_PORT"] != "80") {
  26.       $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
  27.      } else {
  28.       $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
  29.      }
  30.     $postslug = get_post_slug($post->ID);
  31.     if ($img !== "") {
  32.        
  33.    
  34.     echo "<li class='carousel_fix'><a href='$img' class='pirobox' title='$title1'><img class='slider_img_holder' id='".$pageURL.$postslug."'  src='";echo bloginfo('template_directory')."/scripts/timthumb.php?src=".$img."&w=185&h=114&zc=1&q=100'></a><a class='slider_title_holder' href='".$pageURL.$postslug."'>$title1$dots3</a><span class='slider_content_holder'>$cont$dots2</span></li>" ;
  35.  
  36.     }
  37.     endwhile;
  38. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement